Moving off-center node along with sprite animations

Godot Version

Godot 4.3

Question

I have a sprite (enemy) which currently have several states controlled by state machine. One of these states is a searching state, in which they will attempt to track down the player with bias toward their last seen location. The enemy’s sight works with a collision box, and while it has worked well enough so far, I have not been able to rotate this collision box along with the way the sprite is facing.


By default this is what the enemy instance would look like, but in the case the sprite is moving left I am not sure how to get the central circular collision shape to also shift left where the top is anchored to the sprite’s eyes.

Put a node2d as a child of your enemy and add the area2d as a child of this node. When your player changes direction you have to rotate the node2d in the direction the enemy is looking.
Its important that the position of node2d is (0, 0)

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.