JointSuspension Class
This class is used to create a suspension joint. The bodies that represent both a frame and a wheel need to be rigid bodies.
JointSuspension Class
Members
JointSuspension ()
Constructor. Creates a suspension joint with an anchor at the origin of the world coordinates.JointSuspension (const Ptr<Body> & body0, const Ptr<Body> & body1)
Constructor. Creates a suspension joint connecting two given bodies. An anchor is placed between centers of mass of the bodies.Arguments
- const Ptr<Body> & body0 - The wheel to connect with the joint.
- const Ptr<Body> & body1 - The frame to connect with the joint.
JointSuspension (const Ptr<Body> & body0, const Ptr<Body> & body1, const Math::Vec3 & anchor, const Math::vec3 & axis0, const Math::vec3 & axis1)
Arguments
- const Ptr<Body> & body0
- const Ptr<Body> & body1
- const Math::Vec3 & anchor
- const Math::vec3 & axis0
- const Math::vec3 & axis1
float getAngularTorque ()
Returns the maximum torque of the attached angular motor.Return value
Maximum torque.float getAngularDamping ()
Returns the angular damping of the joint (wheel rotation damping).Return value
Angular damping.void setAxis11 (const Math::vec3 & axis11)
Sets a suspension axis in coordinates of the frame: an axis around which the wheel rotates when steering.Arguments
- const Math::vec3 & axis11 - Suspension axis.
float getAngularVelocity ()
Returns the target velocity of wheel rotation.Return value
Target velocity in radians per second.Math::vec3 getAxis10 ()
Returns the suspension axis in coordinates of the wheel.Return value
Suspension axis in coordinates of the wheel.void setWorldAxis1 (const Math::vec3 & axis1)
Sets a suspension axis in the world coordinates.Arguments
- const Math::vec3 & axis1 - Suspension axis in the world coordinates.
float getLinearDamping ()
Returns the linear damping of the suspension.Return value
Linear damping.void setLinearLimitTo (float to)
Sets a high limit of the suspension ride.Arguments
- float to - Limit in units.
float getLinearSpring ()
Returns the rigidity coefficient of the suspension.Return value
Rigidity coefficient.float getCurrentLinearDistance ()
Returns the current suspension compression.Return value
Current suspension height in units.Math::vec3 getAxis00 ()
Returns the wheel axis. This is a wheel spindle.Return value
Wheel axis.void setAngularVelocity (float velocity)
Sets a maximum velocity of wheel rotation.Arguments
- float velocity - Velocity in radians per second.
float getLinearLimitTo ()
Returns the high limit of the suspension ride.Return value
High limit in units.float getLinearLimitFrom ()
Returns the low limit of the suspension ride.Return value
Low limit in units.void setLinearDamping (float damping)
Sets a linear damping of the suspension.Arguments
- float damping - Linear damping. If a negative value is provided, 0 will be used instead.
void setLinearDistance (float distance)
Sets a target height of the suspension.Arguments
- float distance - Height in units.
void setAxis00 (const Math::vec3 & axis00)
Sets a wheel axis along which a wheel moves linearly. This is a shock absorber.Arguments
- const Math::vec3 & axis00 - Wheel axis.
void setLinearSpring (float spring)
Sets a rigidity coefficient of the suspension.Arguments
- float spring - Rigidity coefficient. If a negative value is provided, 0 will be used instead.
void setWorldAxis0 (const Math::vec3 & axis0)
Sets a wheel axis in the world coordinates. This is a wheel spindle.Arguments
- const Math::vec3 & axis0 - Wheel axis in the world coordinates.
void setAxis10 (const Math::vec3 & axis10)
Sets a suspension axis in coordinates of the wheel: an axis around which a wheel rotates when moving forward (or backward).Arguments
- const Math::vec3 & axis10 - Suspension axis.
void setAngularDamping (float damping)
Sets an angular damping of the joint (wheel rotation damping).Arguments
- float damping - Angular damping. If a negative value is provided, 0 will be used instead.
float getLinearDistance ()
Returns the target height of the suspension.Return value
Target height in units.void setAngularTorque (float torque)
Sets a maximum torque of the attached angular motor.Arguments
- float torque - Maximum torque. If a negative value is provided, 0 will be used instead.
Math::vec3 getWorldAxis0 ()
Returns the wheel axis in the world coordinates. This is a wheel spindle.Return value
Wheel axis in the world coordinates.float getCurrentAngularVelocity ()
Returns the current velocity of wheel rotation.Return value
Current velocity in radians per second.Math::vec3 getAxis11 ()
Returns the suspension axis in coordinates of the frame.Return value
Suspension axis in coordinates of the frame.Math::vec3 getWorldAxis1 ()
Returns the suspension axis in the world coordinates.Return value
Suspension axis in the world coordinates.void setLinearLimitFrom (float from)
Sets a low limit of the suspension ride.Arguments
- float from - Limit in units.
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)