Move object to mouse click

Started by qwaqwe, May 09, 2016, 03:57:13 PM

Previous topic - Next topic

qwaqwe

hi

I have a "world" and an object on it (2D). I want to click anywhere on the world and object should move  to the place of click. How can i do this?

EgonOlsen

It depends. If your click happens on real geometry, you can evaluate the collision of the picking way with that geometry. If's there's no actual geometry where you are clicking, you can introduce a hidden plane that acts as a picking plane and is visible only in the picking calculation stage.

The code snippets section in the wiki contains a simple mouse follow demo that shows the basic idea: http://www.jpct.net/wiki/index.php?title=Main_Page#Code_snippets_and_other_tips