Rotate an object with a constant tilt
For my racing game I want to make the steering wheel turn as the vehicle turns. Problem is, The steering wheel is tilted 48 degrees on the z axis. I need to preserve this tilt while rotating the steering wheel left and right. Heres my code so far:
public GameObject SteeringWheel;
private Quaternion Tilt;
Tilt = Quaternion.Euler(0, 0, 48);
SteeringWheel.transform.localRotation = Quaternion.Euler(0, Input.GetAxis("Horizontal") * 180, 0)
it seems that is just ignoring the 48 degree tilt. I feel like I'm making a simple mistake somewhere, so I apologize if this is a stupid question.
Try SteeringWheel.transform.Rotate(0, Input.GetAxis("Horizontal") * 180, 0, Space.Self)
.Rotate uses the local transform axis if set to Space.Self
Your answer
![](https://koobas.hobune.stream/wayback/20220612211357im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
More problems with arrow shooting 0 Answers
Mobile Gyroscope, make Camera always rotating towards zero point using Quaternion 2 Answers
Using a directional vector to orient a sphere? 0 Answers
Quaternion AngleAxis on pitch give random small value on others axis 0 Answers
Help with suns rotation 0 Answers