Unigine.JointWheel Class
Inherits: | Joint |
This class is used to create ray-cast wheels. Both a frame and a wheel are rigid bodies. There is no need to assign a shape to the wheel: ray casting is used to detect collision of the wheel with a surface.
Example#
The following code illustrates connection of two rigid bodies (frame and wheel) using a wheel joint.
JointWheel joint = new JointWheel(frame, wheel);
// setting joint anchor coordinates
joint.WorldAnchor = wheel.Object.WorldTransform * new dvec3(0.0f));
// setting joint axes coordinates
joint.WorldAxis0 = new vec3(0.0f,0.0f,1.0f);
joint.WorldAxis1 = new vec3(0.0f,1.0f,0.0f);
// setting linear damping and spring rigidity
joint.LinearDamping = 200.0f;
joint.LinearSpring = 100.0f;
// setting lower and upper suspension ride limits [-1.0; 0.0]
joint.LinearLimitFrom = -1.0f;
joint.LinearLimitTo = 0.0f;
// setting target suspension height
joint.LinearDistance = 0.5f;
// setting maximum angular velocity and torque
joint.AngularVelocity = -20.0f;
joint.AngularTorque = 10.0f;
// setting wheel parameters
joint.WheelRadius = 0.5f;
joint.WheelMass = 4.0f;
joint.WheelThreshold = 0.1f;
// setting tyre friction parameters
joint.TangentFriction = 4.0f;
joint.BinormalFriction = 5.0f;
// setting number of iterations
joint.NumIterations = 8;
See Also#
- Creating a Car with Wheel Joints usage example.
- UnigineScript API sample <UnigineSDK>/data/samples/joints/wheel_00
- UnigineScript API sample <UnigineSDK>/data/samples/physics/car_02
JointWheel Class
Properties
float CurrentSlipRatio#
The current ratio of wheel spin to ground speed.
float CurrentSlipAngle#
The current angle between the wheel direction and the frame direction.
float WheelThreshold#
The threshold difference between the wheel and ground velocities. when it is too small, the longitudinal force will be scaled down to prevent unnatural vibrations.
set
Sets a threshold difference between the wheel and ground velocities. When it is too small, the longitudinal force will be scaled down to prevent unnatural vibrations.
set value -
Difference threshold. If a negative value is provided, 0 will be used instead.
float WheelRadius#
The radius of the attached wheel.
set
Sets a radius of the attached wheel.
set value -
Radius of the wheel in units. If a negative value is provided, 0 will be used instead.
float WheelMass#
The mass of the attached wheel.
If g (Earth's gravity) equals to 9.8 m/s
2, and 1 unit equals to 1 m, the mass is measured in kilograms.
set
Sets a mass of the attached wheel.
If g (Earth's gravity) equals to 9.8 m/s
2, and 1 unit equals to 1 m, the mass is measured in kilograms.
set value -
Mass of the wheel. If a negative value is provided, 0 will be used instead.
float TangentFriction#
The longitudinal (forward) friction of the tire.
set
Sets a longitudinal (forward) friction of the tire.
set value -
Longitudinal friction. If a negative value is provided, 0 will be used instead.
float TangentAngle#
The coefficient specifying how fast the optimal longitudinal force can be achieved. the larger this value, the more is the impulse produced by the tire.
set
Sets a coefficient specifying how fast the optimal longitudinal force can be achieved. The larger this value, the more is the impulse produced by the tire.
set value -
Coefficient characterizing the tire longitudinal impulse. If a negative value is provided, 0 will be used instead.
float BinormalFriction#
The lateral (sideways) friction of the tire.
set
Sets a lateral (sideways) friction of the tire.
set value -
Lateral friction. If a negative value is provided, 0 will be used instead.
float BinormalAngle#
The coefficient specifying how fast the optimal lateral force can be achieved. the larger this value, the more is the impulse produced by the tire.
set
Sets a coefficient specifying how fast the optimal lateral force can be achieved. The larger this value, the more is the impulse produced by the tire.
set value -
Coefficient characterizing the tire lateral impulse. If a negative value is provided, 0 will be used instead.
float CurrentAngularVelocity#
The current rotation velocity of the attached wheels.
set
Sets the rotation velocity for the attached wheels. For example, it allows to reset it to zero and stop the car when necessary.
set value -
Angular velocity in radians per second.
float AngularVelocity#
The target velocity of wheel rotation.
set
Sets a maximum velocity of wheel rotation.
set value -
Velocity in radians per second.
float AngularTorque#
The maximum torque of the attached angular motor.
set
Sets a maximum torque of the attached angular motor.
set value -
Maximum torque. If a negative value is provided, 0 will be used instead.
float AngularDamping#
The angular damping of the joint (wheel rotation damping).
set
Sets an angular damping of the joint (wheel rotation damping).
set value -
Angular damping. If a negative value is provided, 0 will be used instead.
float CurrentLinearDistance#
The current suspension compression (i.e. the length of the suspension).
set
Sets suspension compression (i.e. the length of the suspension).
set value -
Suspension length in units.
float LinearSpring#
The rigidity coefficient of the suspension.
set
Sets a rigidity coefficient of the suspension.
set value -
Rigidity coefficient. If a negative value is provided, 0 will be used instead.
float LinearLimitTo#
The high limit of the suspension ride.
set
Sets a high limit of the suspension ride.
set value -
Limit in units.
float LinearLimitFrom#
The low limit of the suspension ride.
set
Sets a low limit of the suspension ride.
set value -
Limit in units.
float LinearDistance#
The target height of the suspension.
set
Sets a target height of the suspension.
set value -
Height in units.
float LinearDamping#
The linear damping of the suspension.
set
Sets a linear damping of the suspension.
set value -
Linear damping. If a negative value is provided, 0 will be used instead.
int PhysicsIntersectionMask#
A physics intersection mask of the joint.
set
Sets a physics intersection mask for the joint.
set value -
Integer, each bit of which is a mask.
vec3 WorldAxis1#
The wheel spindle axis in the world coordinates.
set
Sets a wheel spindle axis in the world coordinates.
set value -
Wheel spindle axis in the world coordinates.
vec3 WorldAxis0#
The suspension axis in the world coordinates.
set
Sets suspension axis in the world coordinates.
set value -
Suspension axis in the world coordinates.
vec3 Axis11#
The wheel spindle in coordinates of the wheel (body 1).
set
Sets a wheel spindle axis in coordinates of the wheel (body 1): an axis around which a wheel rotates when steering.
set value -
Wheel spindle axis in coordinates of the wheel (body 1).
vec3 Axis10#
The wheel spindle axis in coordinates of the frame (body 0).
set
Sets a wheel spindle axis in coordinates of the frame (body 0): an axis around which a wheel rotates when moving forward (or backward).
set value -
Wheel spindle axis in coordinates of the frame (body 0).
vec3 Axis00#
Suspension axis coordinates.
set
Sets coordinates of suspension axis, along which a wheel moves vertically. This is a shock absorber.
set value -
Suspension axis.
Members
static JointWheel ( ) #
Constructor. Creates a wheel joint with an anchor at the origin of the world coordinates.static JointWheel ( Body body0, Body body1 ) #
Constructor. Creates a wheel joint connecting two given bodies. An anchor is placed between centers of mass of the bodies.Arguments
- Body body0 - Frame to be connected with the joint.
- Body body1 - Wheel to be connected with the joint.
static JointWheel ( Body body0, Body body1, vec3 anchor, vec3 axis0, vec3 axis1 ) #
Constructor. Creates a wheel joint connecting two given bodies with specified suspension and spindle axis coordinates and an anchor placed at specified coordinates.Arguments
- Body body0 - Frame to be connected with the joint.
- Body body1 - Wheel to be connected with the joint.
- vec3 anchor - Anchor coordinates.
- vec3 axis0 - Suspension axis coordinates.
- vec3 axis1 - Wheel spindle axis coordinates.
vec3 GetContactNormal ( ) #
Returns a normal of a point of contact with the ground, in world coordinates.Return value
Normal.Object GetContactObject ( ) #
Returns an object representing the ground.Return value
Ground object.vec3 GetContactPoint ( ) #
Returns a point of contact with the ground, in world coordinates.Return value
Point coordinates.Shape GetContactShape ( ) #
Returns a shape of the object representing the ground.Return value
Shape of the ground object.int GetContactSurface ( ) #
Returns a surface of a ground object, which is in contact.Return value
Surface number.Last update:
2020-04-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)