Class: ODE::Joint
Instance Attribute Summary
Attributes included from ObjectID
Instance Method Summary collapse
-
#initialize(type, world, group, *rest) ⇒ Joint
constructor
A new instance of Joint.
-
#type ⇒ Object
TODO handle these enumeration constants better…
Methods included from ObjectID
by_id, #method_missing, set_by_id
Constructor Details
#initialize(type, world, group, *rest) ⇒ Joint
Returns a new instance of Joint.
322 323 324 325 |
# File 'lib/ode.rb', line 322 def initialize(type, world, group, *rest) @id = ODE.method("dJointCreate#{(type.to_s.sub(/^[a-z]/) { |m| m.upcase })}").call(world.id, (group==nil)? nil : group.id, *(ODE.convert_args(rest))) ObjectID.set_by_id(@id, self) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ODE::ObjectID
Instance Method Details
#type ⇒ Object
TODO handle these enumeration constants better…
328 329 330 331 332 333 334 335 336 337 338 339 340 |
# File 'lib/ode.rb', line 328 def type { ODE::dJointTypeBall => :ball, ODE::dJointTypeHinge => :hinge, ODE::dJointTypeSlider => :slider, ODE::dJointTypeContact => :contact, ODE::dJointTypeUniversal => :universal, ODE::dJointTypeHinge2 => :hinge2, ODE::dJointTypeFixed => :fixed, ODE::dJointTypeAMotor => :a_motor, ODE::dJointTypePlane2D => :plane2D }[ODE.dJointGetType(@id)] end |