Rotating a sprite towards the pointer

Hi everyone, I need help for rotating a sprite towards the pointer . I search in Phaser Labs but i didn’t found anything . I need your help .
Thanks.

You could use Phaser.Math.Angle.BetweenPoints with the game object and the pointer.

Hi @SlashDev,
I agree with @prob.
You could also use the Phaser.Math.between method.
Here is a way to do it:

See the Pen [Phaser 3] Sprite angle towards pointer by Juan Jose Capellan (@jjcapellan) on CodePen.

1 Like

4 Likes

Excellent the TWO code examples! Both are two nice implementations of the same demand but in different ways!

Thank you VERY MUCH to Samme and jjcapellan!