Example #1
0
        public Pose ExtractPoseValue(IntPtr poseHandle)
        {
            ApiPoseData poseValue = new ApiPoseData(Pose.identity);

            ExternApi.ArPose_getPoseRaw(m_NativeSession.SessionHandle, poseHandle, ref poseValue);
            return(poseValue.ToUnityPose());
        }
Example #2
0
        public IntPtr Create(Pose pose)
        {
            ApiPoseData rawPose = new ApiPoseData(pose);

            IntPtr poseHandle = IntPtr.Zero;

            ExternApi.ArPose_create(m_NativeSession.SessionHandle, ref rawPose, ref poseHandle);
            return(poseHandle);
        }
Example #3
0
        public static void ApiPoseToUnityPose(ApiPoseData apiPose, out Pose unityPose)
        {
            Matrix4x4 glWorld_T_glLocal =
                Matrix4x4.TRS(
                    new Vector3(apiPose.X, apiPose.Y, apiPose.Z),
                    new Quaternion(apiPose.Qx, apiPose.Qy, apiPose.Qz, apiPose.Qw), Vector3.one);
            Matrix4x4 unityWorld_T_unityLocal =
                k_UnityWorldToGLWorld * glWorld_T_glLocal * k_UnityWorldToGLWorldInverse;

            Vector3    position = unityWorld_T_unityLocal.GetColumn(3);
            Quaternion rotation = Quaternion.LookRotation(unityWorld_T_unityLocal.GetColumn(2),
                                                          unityWorld_T_unityLocal.GetColumn(1));

            unityPose = new Pose(position, rotation);
        }
Example #4
0
        public static void UnityPoseToApiPose(Pose unityPose, out ApiPoseData apiPose)
        {
            Matrix4x4 glWorld_T_glLocal =
                Matrix4x4.TRS(unityPose.position, unityPose.rotation, Vector3.one);
            Matrix4x4 unityWorld_T_unityLocal =
                k_UnityWorldToGLWorld * glWorld_T_glLocal * k_UnityWorldToGLWorldInverse;

            Vector3    position = unityWorld_T_unityLocal.GetColumn(3);
            Quaternion rotation = Quaternion.LookRotation(unityWorld_T_unityLocal.GetColumn(2),
                                                          unityWorld_T_unityLocal.GetColumn(1));

            apiPose.X  = position.x;
            apiPose.Y  = position.y;
            apiPose.Z  = position.z;
            apiPose.Qx = rotation.x;
            apiPose.Qy = rotation.y;
            apiPose.Qz = rotation.z;
            apiPose.Qw = rotation.w;
        }
Example #5
0
 public static extern void ArPose_getPoseRaw(
     IntPtr sessionHandle, IntPtr poseHandle, ref ApiPoseData rawPose);
Example #6
0
 public static extern void ArPose_create(
     IntPtr session, ref ApiPoseData rawPose, ref IntPtr poseHandle);