Class: Box2D::RevoluteJoint

Inherits:
Joint show all
Defined in:
lib/box2d/joint.rb

Constant Summary

Constants inherited from Joint

Joint::ID_CLASS

Instance Attribute Summary

Attributes inherited from Joint

#body_a, #body_b

Attributes inherited from Handle

#id, #world

Instance Method Summary collapse

Methods inherited from Joint

#collide_connected=, #collide_connected?, #constraint_force, #constraint_torque, #destroy, #initialize, #invalidate_from_body!, #user_data, #user_data=

Methods inherited from Handle

#destroyed?, #eql?, #hash, #initialize, #valid?

Constructor Details

This class inherits a constructor from Box2D::Joint

Instance Method Details

#angleObject



74
75
76
77
# File 'lib/box2d/joint.rb', line 74

def angle
  ensure_valid!
  Native.b2RevoluteJoint_GetAngle(@id)
end

#limitsObject



99
100
101
102
# File 'lib/box2d/joint.rb', line 99

def limits
  ensure_valid!
  Native.b2RevoluteJoint_GetLowerLimit(@id)..Native.b2RevoluteJoint_GetUpperLimit(@id)
end

#limits=(range) ⇒ Object



104
105
106
107
108
109
110
111
112
# File 'lib/box2d/joint.rb', line 104

def limits=(range)
  ensure_valid!
  Native.b2RevoluteJoint_SetLimits(
    @id,
    ValueConversion.finite_float(range.begin, label: "lower_limit"),
    ValueConversion.finite_float(range.end, label: "upper_limit")
  )
  Native.b2RevoluteJoint_EnableLimit(@id, true)
end

#motor_enabled=(value) ⇒ Object



94
95
96
97
# File 'lib/box2d/joint.rb', line 94

def motor_enabled=(value)
  ensure_valid!
  Native.b2RevoluteJoint_EnableMotor(@id, !!value)
end

#motor_enabled?Boolean

Returns:

  • (Boolean)


89
90
91
92
# File 'lib/box2d/joint.rb', line 89

def motor_enabled?
  ensure_valid!
  Native.b2RevoluteJoint_IsMotorEnabled(@id)
end

#motor_speedObject



79
80
81
82
# File 'lib/box2d/joint.rb', line 79

def motor_speed
  ensure_valid!
  Native.b2RevoluteJoint_GetMotorSpeed(@id)
end

#motor_speed=(value) ⇒ Object



84
85
86
87
# File 'lib/box2d/joint.rb', line 84

def motor_speed=(value)
  ensure_valid!
  Native.b2RevoluteJoint_SetMotorSpeed(@id, ValueConversion.finite_float(value, label: "motor_speed"))
end