- Home /
This question was
closed Feb 07, 2021 at 03:14 AM by
$$anonymous$$ for the following reason:
Answered it myself
How do I move this gameObject in 3 dimensions relative to itself?
I have a spaceship gameObject that rotates based on user input with a DualShock with this code:
yaw1 += camSpeed * Input.GetAxis("R_Horizontal_1");
pitch1 -= camSpeed * Input.GetAxis("R_Vertical_1");
roll1 -= Input.GetAxis("L_Horizontal_1") * camSpeed;
transform.eulerAngles = new Vector3(pitch1, yaw1, roll1);
The problem is that it rotates in world space, so when the ship is on its side, up (or any other direction) is in world space so it rotates in an undesirable direction.
Comment