private void SetRotation(VRTRIXBones bone, Quaternion rotation, bool valid, HANDTYPE type) { string bone_name = VRTRIXUtilities.GetBoneName((int)bone); Quaternion qr = new Quaternion(1f, 0f, 0f, 0f); GameObject obj = GameObject.Find(bone_name); //print(obj); if (obj != null) { if (!float.IsNaN(rotation.x) && !float.IsNaN(rotation.y) && !float.IsNaN(rotation.z) && !float.IsNaN(rotation.w)) { if (valid) { if (type == HANDTYPE.LEFT_HAND) { //obj.transform.rotation = (rotation * qr); obj.transform.rotation = qloffset * (rotation * qr); //print(obj.transform.rotation); } else if (type == HANDTYPE.RIGHT_HAND) { //obj.transform.rotation = (rotation * qr); obj.transform.rotation = qroffset * (rotation * qr); } } } } }
private void SetPosition(VRTRIXBones bone, Vector3 pos, Quaternion rot, Vector3 offset) { string bone_name = VRTRIXUtilities.GetBoneName((int)bone); GameObject obj = GameObject.Find(bone_name); if (obj != null) { obj.transform.position = pos + rot * offset; } }
private Transform[] FindFingerTransform() { Transform[] transform_array = new Transform[(int)VRTRIXBones.NumOfBones]; for (int i = 0; i < (int)VRTRIXBones.NumOfBones; ++i) { string bone_name = VRTRIXUtilities.GetBoneName(i); if (GetComponent("VRTRIXBoneMapping")) { GameObject bone = VRTRIXBoneMapping.UniqueStance.MapToVRTRIX_BoneName(bone_name); if (bone != null) { transform_array[i] = bone.transform; } //print(bone); } } return(transform_array); }