Hello!
I have a script where I can rotate my 2d sprite.
if(Input.GetKey(KeyCode.A)) {
transform.Rotate(0, 0, 3.0f);
}
But how can I achieve a movement that the sprite is still moving towards the (green) x axis after rotation?
Thanks!
Hello!
I have a script where I can rotate my 2d sprite.
if(Input.GetKey(KeyCode.A)) {
transform.Rotate(0, 0, 3.0f);
}
But how can I achieve a movement that the sprite is still moving towards the (green) x axis after rotation?
Thanks!
Hello yes, there is a way the thing is that it appears that you’re moving it respect to local space while you need to move it respect to world space try.
if(Input.GetKey(KeyCode.A)) {
transform.Rotate(0, 0, 3.0f);
transform.Translate(Vector3.right * Time.deltaTime , Space.World);
}