Entity point to mouse not working

I need to make my player constantly point to the mouse, on a 2d plain can someone help me with this?

Hi @Jacob_Mcbride,

You can convert your mouse input to a point in world space using the camera screenToWorld() method and then use the entity lookAt() to rotate it to face that point:

https://developer.playcanvas.com/api/pc.CameraComponent.html#screenToWorld

https://developer.playcanvas.com/api/pc.Entity.html#lookAt

There is also this example that does more things, but you can study the part that rotates the player towards the mouse point:

https://developer.playcanvas.com/en/tutorials/point-and-click-movement/

Can you write a script for me that uses the point that updates every 0.2 seconds?
PLEASE, I really need this, to complete my game.