www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: leorus on July 23, 2014, 03:11:54 am

Title: moving objects with touch event in JPCT-AE
Post by: leorus on July 23, 2014, 03:11:54 am
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
Title: Re: moving objects with touch event in JPCT-AE
Post by: EgonOlsen on July 23, 2014, 08:30:28 am
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 (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.
Title: Re: moving objects with touch event in JPCT-AE
Post by: leorus on July 28, 2014, 01:20:41 pm
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
Title: Re: moving objects with touch event in JPCT-AE
Post by: EgonOlsen on July 28, 2014, 09:45:18 pm
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) (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html#reproject2D3DWS(com.threed.jpct.Camera, com.threed.jpct.FrameBuffer, int, int, float))