In the OnDrag event I need to check the drag direction.
Can how check it?
I wrote this code below but when I drag the game object, it always move to the left.
Thanks
void OnDrag(Vector2 delta)
{
if (transform.localPosition.x > 0)
rigidBody.AddForce (Vector3.right * 20, ForceMode.Impulse);
if (transform.localPosition.x < 0)
rigidBody.AddForce (Vector3.left * 20, ForceMode.Impulse);
if (transform.localPosition.y < 0)
rigidBody.AddForce (Vector3.down * 20, ForceMode.Impulse);
if (transform.localPosition.y > 0)
rigidBody.AddForce (Vector3.up * 20, ForceMode.Impulse);
}