Unity Rotate changes Y transform??
Go to solution
Solved by straight_stewie,
5 hours ago, iLostMyXbox21 said:So i have a unity project and the script changes the movement on the Y axis, it should stay left and right, but now it goes diagonal..
Your current code has movement in local space. You need movement in global space.
transform.Translate(Vector3.right * speed * Time.deltaTime, Space.World); // this moves to the right transform.Translate(Vector3.left * speed * Time.deltaTime, Space.World); // this moves to the left
What you are dealing with is the difference between local position and world position.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now