- Home /
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!
I'm not going to post this as an answer, because it doesn't technically answer your question, but ins$$anonymous$$d of rotating the actual tires, you could just animate the outside texture(s) of the tires so it appears that they're rotating. This might be more performance-friendly than actually rotating the tires really fast.
Hmm. Its a good idea but I dont have the time to individually animate 20+ styles of tire.
Answer by spinaljack · Jun 08, 2010 at 02:21 AM
http://www.gotow.net/andrew/blog/?page_id=78
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.
Your answer
Follow this Question
Related Questions
Tank Wheels and Treads 1 Answer
Rotating child doesn't move parent Rigidbody? 1 Answer
Blender wheels wrong rotation 1 Answer
WheelCollider rotates mesh wrong 1 Answer
Flip over an object (smooth transition) 3 Answers