playMaker

Author Topic: Touch Info - Delta Postion  (Read 5059 times)

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Touch Info - Delta Postion
« on: August 29, 2012, 08:40:04 AM »
Hi,

I'm a little confused what the Store Delta X and Store Delta Y components of the Get info touch is actually reading.
Does anyone know the difference between Store X and Store Delta X??

Thx

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch Info - Delta Postion
« Reply #1 on: August 30, 2012, 04:30:31 AM »
Hi,

 The "store X" is the actual touch position, where "store delta x" is the distance since the last change

http://docs.unity3d.com/Documentation/ScriptReference/Touch.html

so as you move your finger, "store x" will be your current screen position while "store delta X" will be the distance travelled since the last frame ( a very tiny amount). This would be 0 if the finger doesn't move.

bye,

 Jean

markinjapan

  • Full Member
  • ***
  • Posts: 103
Re: Touch Info - Delta Postion
« Reply #2 on: August 31, 2012, 11:48:03 AM »
Tip. This is really good for dragging (via touch) the camera around in something like a RTS game. Just send the X Y delta floats to the camera position and the camera will move when you drag and stop when you stop or release. You'll need to put the Y float in the camera Z position and you might need to multiply it (multiply by -1, etc if you need to reverse it).

So useful, I use it everywhere now.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Touch Info - Delta Postion
« Reply #3 on: September 02, 2012, 09:29:03 PM »
Thx for the reply guys, This is what I expected it to be but when I tried it, it didn't work :S

I got around it by storing the "store x" in a variable in a state above the "store delta X"  ... its just for a prototype so ill revisit it when/if we create the full game.

Cheers