Quantcast
Channel: Answers by "Mortoc"
Viewing all articles
Browse latest Browse all 73

Answer by Mortoc

$
0
0
The problem you have is here: movement.x = Input.GetAxis("Horizontal") * speed; movement.z = Input.GetAxis("Vertical") * speed; You're applying movement in "world-space". If you want to move in relation to your character's orientation, you need to use the direction vectors on your character's transform: movement = (transform.right * Input.GetAxis("Horizontal")) + (transform.forward * Input.GetAxis("Vertical")); movement *= speed; So instead of moving along "x" or "z" you're moving along "transform.right" or "transform.forward". Depending on your character's orientation you may need to use other transform vectors. Check out the "up, forward and right" fields in the transform documentation here: http://docs.unity3d.com/Documentation/ScriptReference/Transform.html

Viewing all articles
Browse latest Browse all 73

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>