Changing the direction of movement
So I have a sphere player object. I'm moving it using rigidbody.AddForce(speed * Vector3). The Vector3 is a vector based off of Input.GetAxis for horizontal and vertical. In other words, the vector will be Vector3(valueofLeftorRight, 0, valueofUporDown).
The player in my game travels down a hallway and turns left at the end of it. So obviously, my camera needs to rotate around the player and face 90deg to the left. I have a trigger at the corner that does this perfectly fine. But now the issue is that my Up and Down arrows are still pushing the player in the same direction, which is now against a wall. So what I need to do is somehow change the axes so that when I press Up/W, the player now moves in the Left/A direction. And then change against based on future turns.
I looked into a few ways to do this... I had the player moving relative to the camera's transform.forward, but I decided it was easier (for other reasons) not to have my player's movement dependent on the camera.
Please help!
Your answer
Follow this Question
Related Questions
Rotation is starting at 0, how do I use Math.Clamp() on it? 1 Answer
Rotating, moving and keep on going with constant velocity in direction of click 1 Answer
Identify custom user input 0 Answers
Problem with halt with rotating on y axis 1 Answer
How i can set Start Position and Ending position in ROTATION AROUND AXIS? 0 Answers