playMaker

Author Topic: Drag position offset (SOLVED)  (Read 2321 times)

adamt

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Drag position offset (SOLVED)
« on: April 15, 2015, 06:35:42 AM »
Hi, I'm trying to create a map type object, so when I touch the screen and drag you can look around the map. I have the touch and drag sorted, but when the finger is lifted off the screen, then pressed back down, the maps position is reset rather than updating.

I'm using a set position. I need for it to somehow remember where it was when the finger was lifted, then when moved it adds to that position.

Any help?  :)
« Last Edit: April 16, 2015, 01:45:58 PM by adamt »

adamt

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Drag position offset
« Reply #1 on: April 15, 2015, 07:01:08 AM »
I've actually managed to get the offset working! I just stored the last position in a variable once the finger is lifted and added it to the current position vector.

However, my problem now is that everytime the screen is touched the centre of the map kind of snaps to the finger, and then it can be dragged as expected. So my question is, how can I make the location the finger touches on contact be 0,0,0?

Thanks!

adamt

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Drag position offset
« Reply #2 on: April 16, 2015, 07:00:15 AM »
Okay, I believe I'm very close.

I have everything in place, except one part!
I'm getting the position of the touch now, which I need to add to the current position of the object, so what I need to do is find the total of the objects current position and position of the touch.

I tried doing this with a Float Add but that recursively adds the position so my object flies of screen. I just to need find a total of the two numbers, until my finger is lifted. Is that possible within playmaker?

Cheers

adamt

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Drag position offset
« Reply #3 on: April 16, 2015, 01:45:28 PM »
All done! Just took a day of experimenting haha...