- Home /
How to make character stop jumping with "transform.forward"?
I'm a beginner on unity and i did a script to move my character forward with the function transform.forward, also another to look around with mouse movement but when i look up and press the key to move, the character jumps. Has a way to fix this or is better use another ways to make the movement? I'm brazilian, sorry for the translations errors :(
Answer by willemd · Jul 03, 2020 at 06:55 AM
Transform.forward refers to forward relative to the object, so when you look up, forward points up, so you appear to jump. For a basic function to move your character forward, I would use new Vector3(transform.forward.x, 0, transform.forward.z).normalized
instead of transform.forward
. This will give you the forward direction without the vertical component.
Your answer
Follow this Question
Related Questions
2D Character Jumps only 1 time 2 Answers
3D Object Jump Glitch 0 Answers
My movement function with jump won't work with collider function 1 Answer
AddForce Movement Constraint 0 Answers
Why does this script make my camera jump when I move back? 1 Answer