Question by
W7nk · May 12, 2020 at 03:43 AM ·
scripting problemscript.vr
Vr hand rotation tracking,Vr hand tracking
I have been trying for the past couple of hours to take a value of the current rotation of the players left hand and subtract it from the past one and then add it to an array or list.
public SteamVR_Action_Skeleton leftSkeletonAction = null;
public SteamVR_Action_Skeleton rightSkeletonAction = null;
public SteamVR_Action_Boolean leftTrigger = null;
// Left Hand
public GameObject leftHand;
public float leftThumbCurl;
public float leftIndexCurl;
public float leftMiddleCurl;
public float leftRingCurl;
public float leftPinkyCurl;
public Vector3 leftHandRotation;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
// GET FINGERMOVEMENT AND TRACKING
// LEFTHAND
leftThumbCurl = leftSkeletonAction.thumbCurl;
leftIndexCurl = leftSkeletonAction.indexCurl;
leftMiddleCurl = leftSkeletonAction.middleCurl;
leftRingCurl = leftSkeletonAction.ringCurl;
leftPinkyCurl = leftSkeletonAction.pinkyCurl;
// LEFTHAND TRACKING
leftHandRotation = UnityEditor.TransformUtils.GetInspectorRotation(leftHand.transform);
if (leftTrigger.state)
{
RecordLeftControlerMovement();
}
}
THE THING DOWN HERE
public Vector3[] numberArray;
public List<Vector3> finalList = new List<Vector3>();
public Vector3 firstVector3;
public Vector3 secoundVector3;
public void RecordLeftControlerMovement()
{
numberArray = new Vector3[2];
numberArray[1] = leftHandRotation;
firstVector3 = numberArray[1];
numberArray[1] = leftHandRotation;
secoundVector3 = numberArray[1];
finalList.Add(firstVector3 - secoundVector3);
}
}
it just adds a 0 to the list so i'm wondering if i just need to slow it down or am i taking the wrong approach to this.
Comment