I wanted to rotate the hand 360 degrees perfectly or in it's y axis only. The y-axis is the circle. Right now it rotates at 300 degrees perfectly.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class PlayerControl : MonoBehaviour
{
public Transform pullStickTransform;
public Vector3 centerPt;
private Vector3 currentPosition;
private Vector3 diffPosition;
private Vector3 currentRotation;
public float dragSpeed;
void Update()
{
if (Input.touchCount > 0)
{
Touch currentTouch = Input.GetTouch(0);
Vector3 touchPos = currentTouch.position;
touchPos.z = Camera.main.WorldToScreenPoint(transform.position).z;
if (currentTouch.phase == TouchPhase.Moved)
{
float rotX = touchPos.x * .01f * Mathf.Deg2Rad;
pullStickTransform.RotateAround(Vector3.up, -rotX);
}
}
}
}
