I'm working on a top down shooter (like hotline miami). I have movement and sprite rotation. I'm trying to get the direction that the sprite is moving relative to it's rotation.
Here is a rough diagram.
So for example, if the sprite was facing right, and it was moving upwards somewhere in between the top two lines, I should be able to get that the sprite is moving "Left". I need this to work regardless of how the sprite is rotated.
The sprite faces the right by default, and I'm using look_at()
to rotate it towards the mouse.
This is how I am getting input to move the player character.
input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
input_vector = input_vector.normalized()
Thanks in advance!