Rotation of an object on button down.

Hi there,

So I have my racing game set-up. Everything works, All the particles, Everything. But i want to add one last feature, Because I havent done it yet. Can somebody help me out on how to rotate the wheels in the car, Suppose i have them as a child to the car body itself (customization of wheels) how can I make these rotate when the player presses the forward key, and lock when pressing the back key?

Thanks in advance!

This tutorial has a section on rotating the wheels.

If you are using wheel colliders then they have a value called rpm which you can use to model the exact rotation speed of the wheels to make it more visually compelling.

If you're using some other kind of driving physics you can just use transform.Rotate on the wheel game objects

make sure that the middle of the wheels are at the origin of the game object and that the z-axis is pointing forward, if not you can put the wheels inside individual container game objects and just rotate that instead.