- Home /
Attached this script to panel object..want to panel rotate in z axis using touch (rotate drag direction on panle)only...but rotating for x,y axis but not z. NOT WORKING Plz HELP
float speed = 3.0f; Touch touch; int id; void Start() { id = touch.fingerId; } void Update() { // transform.RotateAround( );
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved && EventSystem.current.IsPointerOverGameObject(id))
// if(Input.GetMouseButton(0))
{
// Get movement of the finger since last frame
Vector3 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
transform.Rotate(-touchDeltaPosition.x * speed0f,, 0f, -touchDeltaPosition.z * speed, Space.Self);
}
}
Comment