Hi there, below is a couple of lines from my player movement script. Specifically the part allowing the player to move up and down the screen along the z axis. The problem is that when the player is rotated the object moves in a different direction. I need to be able to keep the rotation but stop this object from changing direction when is has rotated.
Hi, a general advice would be to use or check the code from the Character Controller that is in the Standard Asset in the asset store. Using forces on a rigidbody is usually more convenient to move a character than directly modifying a transform.
If you want to continue using transform.Translate, try using transform.Translate( Vector3.right * moveZ, Space.World ): it should move your player “up” regardless of it’s local rotation (well, maybe you’ll need to use Vector3.up or .forward, depending on what is “up” in your world space & camera)