Hello! I have a sphere with rigidbody and sphere collider attached. I want it to move forward/backward using vertical input and to rotate along Y-axis using horizontal input.
But there arises 2 problems:
- When the sphere moves, its axes change (in local scope) and sometimes it rolls aside instead of rotating along the y-axis.
Maybe I have to first set sphere’s rotation to zero and only then rotate it? I’ve tried transform.Rotate and rigidbody.rotation, both methods worked, but they were unnatural and way too fast. While I want my sphere to be affected by physics forces.
If there’s a way to smoothly rotate an object form the any current rotation to “0, horizontal input, 0”, please tell me about it
- After the rotation is done I want my sphere to move forward/backward according to its current rotation (local vectors’ direction). Is the right way to do that is using Rigidbody.AddRelativeForce() ?
I’m new to Unity, therefore any help will be appreciated!
P.S.: sorry for possible grammar mistakes.