tl;dr: Is there a screenToLocal() or something of the like that I can use? If not, will that functionality be available soon?
I gathered from the forums that you can only grab the mouse position when pc.EVENT_MOUSEMOVE is fired. It really sucks when you’re making a sidescrolling shooter since the camera gets stuck often because it’s connected to the mouse position.
I use screenToWorld() to grab the mouse position w.r.t. the world origin and use that to get the ray from the player to the mouse. So far it doesn’t seem like a compute-intensive approach but I think I can do better.
I’m thinking that since screenToWorld() needs to get the mouse position w.r.t the camera position for it to be able to compute for the mouse position w.r.t. the world, I could use that to get the mouse position w.r.t. the player if I make the camera a child of the player instead. Is there like a hidden function that would let me grab that instead? Thanks!
Here’s my current implementation: https://playcanvas.com/editor/scene/874238
ps I’m going to try to make an empty Entity a child of the player and have it lookAt() the mouse position and grab the angle from that if my current approach doesn’t work out.