Esempio n. 1
0
 public static extern FinchUpdateError FinchExternHmdTransformUpdate(
     [In][MarshalAs(UnmanagedType.LPArray)] byte[] rightHand,
     [In][MarshalAs(UnmanagedType.LPArray)] byte[] leftHand,
     [In][MarshalAs(UnmanagedType.LPArray)] byte[] rightUpperArm,
     [In][MarshalAs(UnmanagedType.LPArray)] byte[] leftUpperArm,
     FinchQuaternion qhmd,
     FinchVector3 phmd);
Esempio n. 2
0
        private static PlayerState GetDefaultState()
        {
            PlayerState state = PlayerState.Identity;

            state.NodesState = new FinchNodesState
            {
                Flag = uint.MaxValue
            };

            state.Rotations[PlayerState.Bones[FinchBone.Chest]]         = new FinchQuaternion(0f, 0f, 0f, 1f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.Head]]          = new FinchQuaternion(0f, 0f, 0f, 1f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.LeftShoulder]]  = new FinchQuaternion(0f, 0f, 0f, 1f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.RightShoulder]] = new FinchQuaternion(0f, 0f, 0f, 1f).ToUnity();

            state.Rotations[PlayerState.Bones[FinchBone.RightUpperArm]]   = new FinchQuaternion(0.593858f, -0.293152f, 0.245984f, 0.707733f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.RightLowerArm]]   = new FinchQuaternion(0.5f, -0.5f, 0.5f, 0.5f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.RightHand]]       = new FinchQuaternion(0.5f, -0.5f, 0.5f, 0.5f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.RightHandCenter]] = new FinchQuaternion(0.5f, -0.5f, 0.5f, 0.5f).ToUnity();

            state.Rotations[PlayerState.Bones[FinchBone.LeftUpperArm]]   = new FinchQuaternion(-0.593858f, -0.293152f, -0.245984f, 0.707733f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.LeftLowerArm]]   = new FinchQuaternion(-0.5f, -0.5f, -0.5f, 0.5f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.LeftHand]]       = new FinchQuaternion(-0.5f, -0.5f, -0.5f, 0.5f).ToUnity();
            state.Rotations[PlayerState.Bones[FinchBone.LeftHandCenter]] = new FinchQuaternion(-0.5f, -0.5f, -0.5f, 0.5f).ToUnity();

            state.BonesLengths[PlayerState.Bones[FinchBone.Neck]] = 0.11f;
            state.BonesLengths[PlayerState.Bones[FinchBone.Head]] = 0.12f;

            state.BonesLengths[PlayerState.Bones[FinchBone.RightShoulder]] = 0.2f;
            state.BonesLengths[PlayerState.Bones[FinchBone.RightUpperArm]] = 0.33f;
            state.BonesLengths[PlayerState.Bones[FinchBone.RightLowerArm]] = 0.29f;
            state.BonesLengths[PlayerState.Bones[FinchBone.RightHand]]     = 0.0816f;

            state.BonesLengths[PlayerState.Bones[FinchBone.LeftShoulder]] = 0.2f;
            state.BonesLengths[PlayerState.Bones[FinchBone.LeftUpperArm]] = 0.33f;
            state.BonesLengths[PlayerState.Bones[FinchBone.LeftLowerArm]] = 0.29f;
            state.BonesLengths[PlayerState.Bones[FinchBone.LeftHand]]     = 0.0816f;

            FinchVector3[] boneLocalPositions = new FinchVector3[PlayerState.Bones.BoneCount];

            boneLocalPositions[PlayerState.Bones[FinchBone.Neck]] = new FinchVector3(0f, 0f, 1f);
            boneLocalPositions[PlayerState.Bones[FinchBone.Head]] = new FinchVector3(0f, 0f, 1f);

            boneLocalPositions[PlayerState.Bones[FinchBone.LeftUpperArm]]   = new FinchVector3(0f, 1f, 0f);
            boneLocalPositions[PlayerState.Bones[FinchBone.LeftLowerArm]]   = new FinchVector3(0f, 1f, 0f);
            boneLocalPositions[PlayerState.Bones[FinchBone.LeftHand]]       = new FinchVector3(0f, 1f, 0f);
            boneLocalPositions[PlayerState.Bones[FinchBone.LeftHandCenter]] = new FinchVector3(0f, 0.05f / 0.08f, 0f);

            boneLocalPositions[PlayerState.Bones[FinchBone.RightUpperArm]]   = new FinchVector3(0f, -1f, 0f);
            boneLocalPositions[PlayerState.Bones[FinchBone.RightLowerArm]]   = new FinchVector3(0f, -1f, 0f);
            boneLocalPositions[PlayerState.Bones[FinchBone.RightHand]]       = new FinchVector3(0f, -1f, 0f);
            boneLocalPositions[PlayerState.Bones[FinchBone.RightHandCenter]] = new FinchVector3(0.05f / 0.08f, 0f, 0f);

            UpdateCoordinates(state, LeftArmBones, boneLocalPositions);
            UpdateCoordinates(state, RightArmBones, boneLocalPositions);
            UpdateCoordinates(state, NeckBones, boneLocalPositions);

            return(state);
        }
Esempio n. 3
0
 public static extern void FinchSetOffsetCs(FinchVector3 v);
Esempio n. 4
0
 public static extern void FinchSetCs(FinchVector3 newX, FinchVector3 newY, FinchVector3 newZ);
Esempio n. 5
0
 /// <summary>
 ///     Update Finch Core Data with a transform of the HMD.
 /// </summary>
 /// <param name="qhmd">HMD rotation</param>
 /// <param name="phmd">HMD position</param>
 /// <returns></returns>
 public static FinchUpdateError Update(FinchQuaternion qhmd, FinchVector3 phmd)
 {
     return(Interop.FinchHmdTransformUpdate(qhmd, phmd));
 }
Esempio n. 6
0
 public static Vector3 ToUnity(this FinchVector3 v)
 {
     return(new Vector3(v.X, v.Y, v.Z));
 }
Esempio n. 7
0
 public static extern FinchUpdateError FinchHmdTransformUpdate(FinchQuaternion qhmd, FinchVector3 phmd);