LOOK AT function not working properly

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Idel Dragon

I am having issues with look at func not working properly
In my project i have an enemy that looks at the player but whenever i use the look at func my enemy looks at player with its left side. is there any way to fix this without changing anything on my player

Thx for any help

:bust_in_silhouette: Reply From: kidscancode

You didn’t say whether you were in 2D or 3D, so I’m going to assume 2D.

look_at() aligns the object so that its local x axis points at the target. If your attached sprite is aligned so that the left side is pointing in the x direction, then that’s what’s going to point at the target.

A sprite with 0 rotation should point to the right, along the +x axis.

Rotate the sprite.

Thank u for the help actually I solved the problem by rotating the mesh instance of my enemy.

Idel Dragon | 2020-12-31 13:58