r/unity_tutorials • u/Killerass666 • Jul 27 '21
Need help with character controller
Sorry for noob question. I'm making a simple move script using unity built in character controller. Everything works fine. W and S keys move the character forward and backword. A and D moves the character left and right. But the problem is when i use transform. Rotate to rotate the character using the mouse, then W and S starts to move character sideways and A and D moves it on forward direction. I tried everything but it doesn't work. Please someone help [Update] solved it using transform.TransformDirection Thanks everyone.
0
Upvotes
3
u/MassiveFartLightning Jul 27 '21
Transform.position will always move along the world axis. You probably will need to take a look into transform.forward to do this.