moving objects with touch event in JPCT-AE

Started by leorus, July 23, 2014, 03:11:54 AM

Previous topic - Next topic

leorus

Hello,
I want to move an object in the 3d world with touch event. I do not know how to do it.Can some one help me?
Thanks in advance.
Leo

EgonOlsen

That depends on your needs and your scene setup. You might want to look at this thread: http://www.jpct.net/forum2/index.php/topic,2413.0.html. It contains some code at the end of the thread. The code is for desktop jPCT but the basic idea will also work in jPCT-AE. Another way (if the object has to follow actual geometry), would be to use collision detection for this.

leorus

I tried that, but not succeeded. I am able to move the object with touch event, but, it moves only very little. I think the problem is with the difference between screen coordinates and world space coordinates. Can any one suggest how to convert the screen (mouse or touch) coords to world ( object ) coords. Also I want to move the object at z pos of -30 ( World coords). Now it moves only at z pos. of 0. I need help in this matter also.
Thanks in advance.

Leo

EgonOlsen

As mentioned, it highly depends on the scene and what your touch event is supposed to do. If i got you correctly, maybe this is already sufficient: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html#reproject2D3DWS(com.threed.jpct.Camera, com.threed.jpct.FrameBuffer, int, int, float)