Author Topic: Move object by touch in x and y axis  (Read 828 times)

Offline billda

  • byte
  • *
  • Posts: 12
    • View Profile
Move object by touch in x and y axis
« on: September 08, 2014, 02:24:14 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Move object by touch in x and y axis
« Reply #1 on: September 08, 2014, 08:55:17 pm »
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".

Offline billda

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Move object by touch in x and y axis
« Reply #2 on: September 09, 2014, 09:17:44 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Move object by touch in x and y axis
« Reply #3 on: September 09, 2014, 10:49:29 am »
But you don't have to change it... I guess i don't really got the actual question then...

Offline billda

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Move object by touch in x and y axis
« Reply #4 on: September 09, 2014, 01:44:10 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Move object by touch in x and y axis
« Reply #5 on: September 09, 2014, 05:34:53 pm »
OK, then that distance is your depth for that method call.