|
I have an object with a move script and a rotate script. The rotate script makes the 'player' rotate to face the direction he is moving in, the problem is that when the object rotates, so does his sense of 'forward', and he ends up walking backwards. I've tried changing the 'tool handles' to global, but it's still happening. How do i rotate the object without affecting the movement direction? Thanks, Tom.
(comments are locked)
|
|
The 'tool handles' (transform gizmo) is only for you, when you place objects in the scene. It has no influence on the objects during runtime. If you want to move an object in world coordinates, you have to refrain from using local vectors like 'transform.forward'. Also most functions work in local space by default, and in that case 'Vector3.forward' is also in local coordinates. You'd have to specify that you want to use world coordinates. Examples:
(comments are locked)
|
|
Nice. Space.World is a new one to me, i'll look it up on the script reference! Thank you very much, i'm sure this will be the solution. You are a very helpful genius :) :)
(comments are locked)
|
|
Yeah, that seems to have done it :)
(comments are locked)
|
