# Unigine::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.

## static JointSuspensionPtr create()

Constructor. Creates a suspension joint with an anchor at the origin of the world coordinates.

## static JointSuspensionPtr create(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 - Frame to be connected with the joint.
• const Ptr<Body> & body1 - Wheel to be connected with the joint.

## static JointSuspensionPtr create(const Ptr<Body> & body0, const Ptr<Body> & body1, const Math::Vec3 & anchor, const Math::vec3 & axis0, const Math::vec3 & axis1)

Constructor. Creates a suspension joint connecting two given bodies with specified suspension and spindle axis coordinates and an anchor placed at specified coordinates.

### Arguments

• const Ptr<Body> & body0 - Frame to be connected with the joint.
• const Ptr<Body> & body1 - Wheel to be connected with the joint.
• const Math::Vec3 & anchor - Anchor coordinates.
• const Math::vec3 & axis0 - Suspension axis coordinates.
• const Math::vec3 & axis1 - Wheel spindle axis coordinates.

## Ptr<JointSuspension>cast(const Ptr<Joint> & joint)

Casts a JointWheel out of the Joint instance.

### Arguments

• const Ptr<Joint> & joint - Joint instance.

JointSuspension.

## voidsetAngularDamping(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.

## floatgetAngularDamping()

Returns the angular damping of the joint (wheel rotation damping).

Angular damping.

## voidsetAngularTorque(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.

## floatgetAngularTorque()

Returns the maximum torque of the attached angular motor.

Maximum torque.

## voidsetAngularVelocity(float velocity)

Sets a maximum velocity of wheel rotation.

### Arguments

• float velocity - Velocity in radians per second.

## floatgetAngularVelocity()

Returns the target velocity of wheel rotation.

### Return value

Target velocity in radians per second.

## voidsetAxis00(const Math::vec3 & axis00)

Sets coordinates of suspension axis, along which a wheel moves vertically. This is a shock absorber.

### Arguments

• const Math::vec3 & axis00 - Suspension axis.

## Math::vec3getAxis00()

Returns suspension axis coordinates.

Suspension axis.

## voidsetAxis10(const Math::vec3 & axis10)

Sets a wheel spindle axis in coordinates of the wheel: an axis around which a wheel rotates when moving forward (or backward).

### Arguments

• const Math::vec3 & axis10 - Wheel spindle axis in coordinates of the wheel.

## Math::vec3getAxis10()

Returns the wheel spindle axis in coordinates of the wheel.

### Return value

Wheel spindle axis in coordinates of the wheel.

## voidsetAxis11(const Math::vec3 & axis11)

Sets a wheel spindle axis in coordinates of the frame: an axis around which a wheel rotates when steering.

### Arguments

• const Math::vec3 & axis11 - Wheel spindle axis in coordinates of the frame.

## Math::vec3getAxis11()

Returns the wheel spindle in coordinates of the frame.

### Return value

Wheel spindle axis in coordinates of the frame.

## floatgetCurrentAngularVelocity()

Returns the current velocity of wheel rotation.

### Return value

Current velocity in radians per second.

## floatgetCurrentLinearDistance()

Returns the current suspension compression.

### Return value

Current suspension height in units.

## voidsetLinearDamping(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.

## floatgetLinearDamping()

Returns the linear damping of the suspension.

Linear damping.

## voidsetLinearDistance(float distance)

Sets a target height of the suspension.

### Arguments

• float distance - Height in units.

## floatgetLinearDistance()

Returns the target height of the suspension.

### Return value

Target height in units.

## voidsetLinearLimitFrom(float from)

Sets a low limit of the suspension ride.

### Arguments

• float from - Limit in units.

## floatgetLinearLimitFrom()

Returns the low limit of the suspension ride.

### Return value

Low limit in units.

## voidsetLinearLimitTo(float to)

Sets a high limit of the suspension ride.

### Arguments

• float to - Limit in units.

## floatgetLinearLimitTo()

Returns the high limit of the suspension ride.

### Return value

High limit in units.

## voidsetLinearSpring(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.

## floatgetLinearSpring()

Returns the rigidity coefficient of the suspension.

### Return value

Rigidity coefficient.

## voidsetWorldAxis0(const Math::vec3 & axis0)

Sets suspension axis in the world coordinates.

### Arguments

• const Math::vec3 & axis0 - Suspension axis in the world coordinates.

## Math::vec3getWorldAxis0()

Returns the suspension axis in the world coordinates.

### Return value

Suspension axis in the world coordinates.

## voidsetWorldAxis1(const Math::vec3 & axis1)

Sets a wheel spindle axis in the world coordinates.

### Arguments

• const Math::vec3 & axis1 - Wheel spindle axis in the world coordinates.

## Math::vec3getWorldAxis1()

Returns the wheel spindle axis in the world coordinates.

### Return value

Wheel spindle axis in the world coordinates.
Last update: 03.07.2017