Isn’t there any simple way of writing the script of rotating the mesh in +x or -x axis?
(Total Beginner)
1 Answer
1@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.
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.
– Cherno