Class: Box2D::PrismaticJoint

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

#limits=(range) ⇒ Object



136
137
138
139
140
141
142
143
144
# File 'lib/box2d/joint.rb', line 136

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

#motor_speedObject



126
127
128
129
# File 'lib/box2d/joint.rb', line 126

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

#motor_speed=(value) ⇒ Object



131
132
133
134
# File 'lib/box2d/joint.rb', line 131

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

#speedObject



121
122
123
124
# File 'lib/box2d/joint.rb', line 121

def speed
  ensure_valid!
  Native.b2PrismaticJoint_GetSpeed(@id)
end

#translationObject



116
117
118
119
# File 'lib/box2d/joint.rb', line 116

def translation
  ensure_valid!
  Native.b2PrismaticJoint_GetTranslation(@id)
end