- Home /
CharacterController.Move Issue
So I'm trying to move my character in local space using the CharacterController.Move function. I am calculating the x,y,and z values, then pass them to transform.TransformDirection. When using transform.Translate everything works properly and the player will move forward in the direction it's facing. But when I pass that same vector to controller.move, it moves in world space. Not sure what would cause this.
Answer by Acorlett48 · Mar 03, 2012 at 01:05 AM
Dumb mistake on my part. If I had posted the code it would have been an easy fix anyways. Turns out I had only put transform.TransfromDirection(moveDirection); when i needed code to actually change the vector. transform.Translate( ) does this automatically when set to Space.self (default).
so I simply needed to use moveDirection = transform.TransformDirection(moveDirection).
Well thats how you learn..
Answer by Jessy · Mar 02, 2012 at 10:24 PM
What would cause it, is that that is how it was implemented. The documentation shows you how to deal with it, via Transform.TransformDirection.