I am taking a unity class in school and i may have made my project a bit overly ambitious. Essentially I am taking an old 2D side scroller game and trying to make it in 3D. Therefore my character can move left and right. forward and backwards on platforms. But i need my characters to turn exactly 90degrees in Y (no inbetweens) to face the left and right and exactly 180 degrees to face back. I’ve tried transform.Rotate(0,90,0) and transform.Rotate(0,-90,0) but it doesn’t take into account if my character has faced left twice (and now is facing back) and I now want it to face forwards. Is there a way of making sure that the character faces left side of the world when the it turns left and the right side of the world when it turns right. And the same for front and back. ( i am using the wasd keys to control the characters movements),
You could try setting up four Quaternion rotations and just set the transform.rotation to one of the four.
see Unity - Scripting API: Transform.rotation
@CmdrZin Do you have an example of how you would set up for quaternion rotation? O_O I tried it using transform.rotation = Quaternion.Euler(transform.rotation.x, -90, transform.rotation.z) and so on for all the directions, and while my player rotates like i want them to, i know Quaternion messes with the numbers making it go all crazy and my player stops being able to move.