Move object by touch in x and y axis

Started by billda, September 08, 2014, 02:24:14 PM

Previous topic - Next topic

billda

Hi, I want to move my finger on the screen and move the object with it. I found here http://www.jpct.net/forum2/index.php?topic=2418.0  example that remap 2D coordinates of touch to 3D coordinates in plane .. but it is not what i want .. i dont want to change "depth" of object, just x and y coordinates. Can I use some of that remapping methods that are in Interact2D class? Or is it somehow easy? Thanks for some hint

EgonOlsen

You always have a depth. You have to, because you can't make the missing coordinate up in any way when transforming from 2d into 3d. You have to give that point a depth or you would end up with an endless count of solutions for the equation.
In your case, the depth might simply be the distance of the object to move from the "screen".

billda

Thanks for reply .. I am not saying that i dont want to set depth, only that i dont want to change it .. I would like to have that z coordinate always the same and change only x and y.

EgonOlsen

But you don't have to change it... I guess i don't really got the actual question then...

billda

Well I am basically trying to achieve the same effect as with "picking" but I dont want to actually need to pick object. Just everywhere when i touch screen, object should appear on that position. With that code i posted in first post, i was positioning that model on some plane that was parallel with X axis .. and i dont want that, i want to move it on the plane that is parallel with Y axis in some distance that will be constant.

EgonOlsen

OK, then that distance is your depth for that method call.