- Home /
How can i rotate my car steering wheel in accordance to the wheels?
Isn't there any simple way of writing the script of rotating the mesh in +x or -x axis? (Total Beginner)
public Transform steeringWheel;
public Transform wheels;
void Update() {
Vector3 eulerAngles_steeringWheel = steeringWheel.eulerAngles;
Vector3.eulerAngles_wheels = wheels.eulerAngles;
eulerAngles_wheels.x = eulerAngles_steeringWheel.x;
wheels.eulerAngles = eulerAngles_wheels;
}
You'll possible have to change the axis of the steering wheel and/or wheels to get the desired result, it depends on the way your objects have their pivots oriented.
Answer by IronarmGames_LLC · Jul 24, 2016 at 06:23 AM
@fahdfadoo , You can do this simply by knowing what the rotation limits are of your wheels, then you can normalize these values in a range of -1 to 1. After that, you can multiply the rotation of your steering wheel via a transform.Rotate method against the current rotation and then clamp that value to be sure you cant constantly rotate the steering wheel.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
stabilize car? help! 0 Answers
TOP down 2d car physics 0 Answers
Car Physics 0 Answers
simple drift car movement 0 Answers