Move Object to Mouse

Hello, I’m Hizard.

No matter how much I think about it, I don’t know the answer, so I post a question.
My problem is moving object to mouse pointer. It’s like a Social Network Game.

This is my project link:
https://playcanvas.com/project/1072612/overview/moveobj

Creating a mousemove function in the raycast.js file.
I’ve already fixed it serveral times. :sob:

Please, Can I get your tips or answers?

Hi @Hizard,

In your mouseMove method you are trying to access this.hitEntity but you’re doing that before checking if there is a hit in your doRaycast method.

There is a nice example here that you can check on how to move an object on click:

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

1 Like