Sprite2D rotation problem

Godot Version

Godot_V.4.3

Question

The enemy tank, the one who is following me using NavigationAgent2D is made of 2 Sprite2D, one is the canon that is looking at the player, and the other one is body. How do i make body of enemy tank rotate base on direction of enemy tank, i know its complicated but please help.

Maybe something like this:

func _physics_process(delta):
    ... # heres your movement code
    sprite.look_at(global_position + velocity)

To be honest i dont know what does that mean, but it does work, so thank you alot :upside_down_face:

“look_at” makes the node look at the given position and global_position + velocity is the target_position you want to reach

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