Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Touch.deltaPosition

var deltaPosition: Vector2;
Vector2 deltaPosition;
deltaPosition as Vector2

Description

The position delta since last change.

The absolute position of the touch is recorded periodically and available in the position property. The deltaPosition value is a Vector2 that represents the difference between the touch position recorded on the most recent update and that recorded on the previous update. The deltaTime value gives the time that elapsed between the previous and current updates; you can calculate the touch's speed of motion by dividing deltaPosition.magnitude by deltaTime.

See Also: deltaTime.