Legacy Documentation: Version 4.5
Previous
Slider Joint 2D
Next
Ragdoll Wizard

Wheel Joint 2D

Switch to Scripting

A Wheel Joint 2D is used to simulate a rolling wheel on which an object can move, optionally with motor power applied. The wheel uses a suspension “spring” to maintain its distance from the main body of the vehicle.

Properties

Property: Function:
Collide Connected Should the Rigidbody collide with the one it is connected to by the joint?
Connected Rigidbody The Rigidbody object that the wheel object is connected to.
Anchor Coordinate in local space where the end point of the joint is attached.
Connected Anchor Coordinate in the other object’s local space where its end of the joint is attached.
Suspension
Damping Ratio Fraction of the suspension force that is reduced in proportion to the movement speed of the suspension.
Frequency Frequency of oscillation of the suspension spring as it comes to rest.
Local Axis Direction along which the suspension travels.
Use Motor Should a motor force be applied to the wheel?
Motor
Motor Speed Target speed (degrees per second) for the motor to reach.
Maximum Motor Force Maximum force applied to the Rigidbody to attain the desired speed.

Details

Unlike the Wheel Collider used with 3D physics, the Wheel Joint 2D uses a separate Rigidbody object for the wheel, which actually rotates when the force is applied. (The Wheel Collider, by contrast, simulates the suspension using a raycast and the wheel’s rotation is purely a graphical effect). The wheel object will typically be a Circle Collider 2D with a Physics Material 2D that gives the right amount of traction for your gameplay.

To simulate a car or other vehicle, you will usually want to set the Motor Speed property to zero in the inspector and then vary it from your script according to the player’s input. You might also change the value of Maximum Motor Force to simulate the effect of gear changes and power-ups.

Previous
Slider Joint 2D
Next
Ragdoll Wizard