Space Shooter Tutorial tilting extra
Hello,
I was doing the Space Shooter Tutorial and at the part where the tilting is being added i was trying to add it over the x axis as well. Instead of just tilting left and right, also over front and back. However, i just want it to tilt when moving forward, and remaining at 0 when it goes back. I am new to coding so what i have implemented might seem basic and it is not working.
Here is the code for the tilting mechanic with my extra attempt:
if (transform.rotation.x > 90) { rb.rotation = Quaternion.Euler( 0.0f, 0.0f, rb.velocity.x -tilt); } else { rb.rotation = Quaternion.Euler( rb.velocity.z (tilt), 0.0f, rb.velocity.x * -tilt); }
I think that i am doing a check instead of blocking an action and that is what i am doing wrong.
Help Please!
Your answer
Follow this Question
Related Questions
Why Quaternion.Euler can't rotate 360 Degrees 0 Answers
Quaternion/World Local rotation problem 0 Answers
Draw a ray from a gamobject and keep direction of the ray relative to the gameobjects rotation. 1 Answer
Keydoor problem 0 Answers
How to make a 2D sprite rotate towards a specific point while facing perpendicular to the camera ? 1 Answer