8 way character rotation only works in one direction? 5.6.1

Hello! I’m not sure if this is the right place to post this, but it is for a character. Though if needed, I can delete the post. I’m developing a game in the style of doom/duke nukem, and I’m struggling to get 8 way sprite rotation working.

sprite issue

It works, but only in one direction. Although the sprite changes, it only faces in the direction of X direction. The purple arrow points to where the “front” of the sprite is, and I can’t seem to figure out how to get the sprites forward direction to change to the direction of the arrow.

This is the code used to get the rotation for the sprite itself facing the player. I can provide more information, or the project file if needed.

Figured it out! I’ll put it here in case somebody else has this issue. I looked into more vector math nodes, and this worked. (The negative multiplier is to correct the rotation)

rotation fix