//Populate bones and joints gameobjects void InitializeGameobjects() { myJoints = new GameObject[MaxHands][]; myBones = new GameObject[MaxHands][]; jointData = new PXCMHandData.JointData[MaxHands][]; for (int i = 0; i < MaxHands; i++) { myJoints[i] = new GameObject[MaxJoints]; myBones[i] = new GameObject[MaxJoints]; smoother3D[i] = new PXCMSmoother.Smoother3D[MaxJoints]; jointData[i] = new PXCMHandData.JointData[MaxJoints]; } for (int i = 0; i < MaxHands; i++) { for (int j = 0; j < MaxJoints; j++) { smoother3D[i][j] = smoother.Create3DWeighted(weightsNum); jointData[i][j] = new PXCMHandData.JointData(); if (j == 1) { myJoints[i][j] = (GameObject)Instantiate(PalmCenterPrefab, Vector3.zero, Quaternion.identity); } else if (j == 21 || j == 17 || j == 13 || j == 9 || j == 5) { myJoints[i][j] = (GameObject)Instantiate(TipPrefab, Vector3.zero, Quaternion.identity); } else { myJoints[i][j] = (GameObject)Instantiate(JointPrefab, Vector3.zero, Quaternion.identity); } if (j != 1) { myBones[i][j] = (GameObject)Instantiate(BonePrefab, Vector3.zero, Quaternion.identity); } } } }
private void CreateSmootherType(SmoothingTypes type, float factor, out PXCMSmoother.Smoother3D smoother) { switch (type) { case SmoothingTypes.Quadratic: smoother = _smoother.Create3DQuadratic(factor); break; case SmoothingTypes.Stabilizer: smoother = _smoother.Create3DStabilizer(7, factor); break; case SmoothingTypes.Weighted: smoother = _smoother.Create3DWeighted((int)factor); break; case SmoothingTypes.Spring: default: smoother = _smoother.Create3DSpring(factor); break; } }