- Home /
eulerAngles + quaternion + car = help!?!
hi i am trying to make a car that runs on physics. what i have now is all the wheels have colliders and rigidbodys and hingeJoints to make them pivot. i am using rigidbody.AddRelativeTorque
to make the wheel spin.
but what i am trying to do now it make the car steer. I dont know how to rotate objects using physics. so i am using the transform.eulerAngles
or transform.rotation
but. it does not seem to work.
Please Help!
Answer by Mike 3 · Jun 12, 2010 at 03:31 PM
You already had it - rigidbody.AddRelativeTorque on the car itself, around Vector3.up
what i am trying to do is make the car run on physics so that the front wheels will turn left or right and the car will turn using physics
I'm not sure how well the physics system will work that way. If you can get enough friction to drive your car forward from the torque, then rotating a parent object to each wheel may be the easiest way
Answer by duck · Oct 16, 2010 at 07:44 AM
You should use wheelcolliders rather than attempting to implement wheels by spinning your own wheel-shaped rigidbody objects.
You don't turn or roll the WheelCollider object, they just stay fixed in a static position relative to the car. You apply torque to them and "Steer" them by adjusting values on the wheelcollider, and they will apply force to the car as appropriate.
One of the reasons for using this is that if you try to spin a regular wheel fast enough to make a car travel at high speed, the wheel might have to rotate more than a complete 360 turn each frame, which the physics engine cannot realistically simulate.
The wheel collider also simulates the dynamic and non-linear grip that a wheel provides, which is very difficult to simulate using a regular physics rigidbody.
thanks duck! after the first few days of not using wheelcolliders i gave up :( lol thanks for answering tho!
np. Incidentally, wheelcolliders also handle steering, you just pass the steering value to them, and they apply the correct forces to the car's rigidbody. This means you don't have to add torque to make your car body turn.
Your answer
Follow this Question
Related Questions
When applying a 90 degree rotation to Euler Angles, it is over/undershooting sometimes.. 2 Answers
How to rotate an object around another 60 degrees with a keypress? 0 Answers
Rotate on X axies towards an objects height in 3D 1 Answer
Why is my rotation so weird? 1 Answer
Rotating a model with increments 1 Answer