Exemple #1
0
        void LateUpdate()
        {
            MyClient.GetFrame();

            Output_GetSubjectRootSegmentName OGSRSN = MyClient.GetSubjectRootSegmentName(SubjectName);



//			ApplyBoneTransform(Root);

            // keep the camera looking at the model
            Output_GetSegmentGlobalTranslation RootPos = MyClient.GetSegmentGlobalTranslation(SubjectName, OGSRSN.SegmentName);

            if (RootPos.Occluded)
            {
                return;
            }

            Output_GetSegmentGlobalRotationQuaternion RootRotation = MyClient.GetSegmentGlobalRotationQuaternion(SubjectName, OGSRSN.SegmentName);

            Quaternion pose   = new Quaternion((float)RootRotation.Rotation[0], (float)RootRotation.Rotation[1], (float)RootRotation.Rotation[2], (float)RootRotation.Rotation[3]);
            Vector3    Target = new Vector3(-(float)RootPos.Translation[0] / 1000f, (float)RootPos.Translation[1] / 1000f, (float)RootPos.Translation[2] / 1000f);

            gameObject.transform.position = Target;
            gameObject.transform.rotation = pose;
        }
Exemple #2
0
    // Creating a rotation quaternion using the Vicon data
    public Quaternion MakeRotationQuaternion(string subjectName, string rootSegmentName)
    {
        Output_GetSegmentGlobalRotationQuaternion globalRotation = mViconClient.GetSegmentGlobalRotationQuaternion(subjectName, rootSegmentName);
        Quaternion localRotation = new Quaternion(
            (float)(globalRotation.Rotation[0]),
            (float)(globalRotation.Rotation[1]),
            (float)(globalRotation.Rotation[2]),
            (float)(globalRotation.Rotation[3])
            );

        return(localRotation);
    }