Class: CP::PivotJoint

Inherits:
Object
  • Object
show all
Includes:
Constraint
Defined in:
lib/chipmunk-ffi/constraints/pivot_joint.rb

Constant Summary

Constants included from Constraint

Constraint::DampedRotarySpring, Constraint::DampedSpring, Constraint::GearJoint, Constraint::GrooveJoint, Constraint::PinJoint, Constraint::PivotJoint, Constraint::RatchetJoint, Constraint::RotaryLimitJoint, Constraint::SimpleMotor, Constraint::SlideJoint

Instance Attribute Summary

Attributes included from Constraint

#body_a, #body_b, #struct

Instance Method Summary collapse

Methods included from Constraint

included, #set_data_pointer

Constructor Details

#initialize(a_body, b_body, anchr_one, anchr_two = nil) ⇒ PivotJoint

Returns a new instance of PivotJoint.



21
22
23
24
25
26
27
28
29
30
# File 'lib/chipmunk-ffi/constraints/pivot_joint.rb', line 21

def initialize(a_body, b_body, anchr_one, anchr_two=nil)
  @body_a, @body_b = a_body, b_body
  @struct = if anchr_two.nil?
    PivotJointStruct.new(CP.cpPivotJointNew(
      a_body.struct.pointer,b_body.struct.pointer,anchr_one.struct))
  else
    PivotJointStruct.new(CP.cpPivotJointNew2(
      a_body.struct.pointer,b_body.struct.pointer,anchr_one.struct,anchr_two.struct))
  end
end