Example #1
0
        public static IntPtr Create(IntPtr sessionHandle, Pose pose)
        {
            ApiPose apiPose    = Translators.ToApiPose(pose);
            IntPtr  poseHandle = IntPtr.Zero;

            ExternApi.ArPose_create(
                sessionHandle,
                ref apiPose,
                ref poseHandle);
            return(poseHandle);
        }
Example #2
0
        public static IntPtr Create(IntPtr sessionHandle)
        {
            ApiPose apiPose    = new ApiPose();
            IntPtr  poseHandle = IntPtr.Zero;

            ExternApi.ArPose_create(
                sessionHandle,
                ref apiPose,
                ref poseHandle);
            return(poseHandle);
        }
Example #3
0
        public static ApiPose GetAnchorPose(
            IntPtr sessionHandle,
            IntPtr anchorHandle)
        {
            IntPtr poseHandle = PoseApi.Create(sessionHandle);

            ExternApi.ArAnchor_getPose(sessionHandle, anchorHandle, poseHandle);
            ApiPose apiPose = PoseApi.ExtractPoseValue(sessionHandle, poseHandle);

            PoseApi.Destroy(poseHandle);
            return(apiPose);
        }
Example #4
0
        public static ApiPose ExtractPoseValue(
            IntPtr sessionHandle,
            IntPtr poseHandle)
        {
            ApiPose apiPose = Translators.ToApiPose(Pose.identity);

            ExternApi.ArPose_getPoseRaw(
                sessionHandle,
                poseHandle,
                ref apiPose);
            return(apiPose);
        }
Example #5
0
        public static Pose ToUnityPose(ApiPose apiPose)
        {
            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));

            return(new Pose(position, rotation));
        }
Example #6
0
 public static extern void ArPose_getPoseRaw(
     IntPtr sessionHandle,
     IntPtr poseHandle,
     ref ApiPose apiPose);
Example #7
0
 public static extern void ArPose_create(
     IntPtr sessionHandle,
     ref ApiPose apiPose,
     ref IntPtr poseHandle);