Hi - I’m using unity in conjunction with an ipad to throw an object based on a user dragging their finger across the screen. But when a user moves their finger vertically on the screen, I want that to translate to a movement of the object on the Z axis instead of the Y. How would I accomplish this? Here’s my code.
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
// Get movement of the finger since last frame
var touchDeltaPosition:Vector3 = Input.GetTouch(0).deltaPosition;
// Apply force to the object
newObject.rigidbody.AddForce(touchDeltaPosition * force);
}