Im trying to figure out how to make my plane object rotate and go up and down in the Y axis with touch on a mobile device. It is a little laggy and it goes backwards in the Z direction too much so when you start to go down it will rotate in a full circle instead of smoothly going down and up in the Y axis. What I want to accomplish is have the plane go down in a smooth direction while rotating down and up slowly, but it is very laggy and slow. Here is my code to show an example of what I’m talking about:
public float speed = 0.1f;
public static int forwardSpeed = 20;
public Vector3 userDirection = Vector3.right;
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
// Get movement of the finger since last frame
Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
// Move object across XY plane
transform.Translate(0, touchDeltaPosition.y * speed, 0);
transform.Rotate(0, 0, touchDeltaPosition.y * speed/0.8f);
}