- Home /
transform.TransformDirection for angled cam
Using a 3rd person cam and a super basic movement script. If the camera is rotated in any Y axis, movedirection is converted and performs as expected, relative to the camera's angle, the player moves left or right, up or down, on the screen.
moveDirection = cam.transform.TransformDirection(moveDirection);
characterController.move(MoveDirection * Time.deltaTime);
However, if I have X rotated in any direction on the cam, the amount of direction down to 90, reduces the players movement. So, at 90 rotation, the vertical axis input from the player is disabled and movedirection.x is ALWAYS 0, while horizontal input is not affected. If I lower to 45 rotation on X rotation of the cam, then moveDirection becomes half the speed in a single input axis.
What am I missing here?
How is moveDirection calculated? Do you have any child objects with colliders on the CharacterController object? If so, turn off the colliders on the child objects to see what happens. Your horizontal speed will be reduced when you tilt the camera down since more the of the total movement is vertical, but that does not sound like your issue.
Your answer
Follow this Question
Related Questions
TransformDirection is only working on Y Axis 0 Answers
Why does my code works? 0 Answers
Push the player forward C# 0 Answers
random direction just in 2d 2 Answers
transformDirection goes to zero as I look upwards. 0 Answers