Topic was automatically imported from the old Question2Answer platform.
Asked By
Deith
I know this is a very simple question but I’m new to vectors and calculating them so I just get confused.
I have an NPC scene with AnimationSprite that has four animations: up, down, left, right and I have a player that I want to basically turn the NPC towards (by playing correct animation). I have both NPC position and player position and I just can’t figure out how to calculate whether the player is on the right, left, above or below and I don’t want to just make dozen if statements. So how do I calculate that? I know the answer is right there and it’s very simple I just can’t visualise it.
I solved it by making Idle animation for the NPC with animationPlayer instead, and just input (player_position - npc_position).normalized() as vector for animationTree.