Esempio n. 1
0
 private static void _anchor_removed(UnityARAnchorData anchor)
 {
     if (UnityARSessionNativeInterface.ARAnchorRemovedEvent != null)
     {
         ARPlaneAnchor planeAnchorFromAnchorData = GetPlaneAnchorFromAnchorData(anchor);
         UnityARSessionNativeInterface.ARAnchorRemovedEvent(planeAnchorFromAnchorData);
     }
 }
 static void _anchor_removed(UnityARAnchorData anchor)
 {
     if (ARAnchorRemovedEvent != null)
     {
         ARPlaneAnchor arPlaneAnchor = new ARPlaneAnchor(anchor);
         ARAnchorRemovedEvent(arPlaneAnchor);
     }
 }
Esempio n. 3
0
 static void _anchor_updated(UnityARAnchorData anchor)
 {
     if (ARAnchorUpdatedEvent != null)
     {
         ARPlaneAnchor arPlaneAnchor = GetPlaneAnchorFromAnchorData(anchor);
         ARAnchorUpdatedEvent(arPlaneAnchor);
     }
 }
        public ARPlaneAnchor(UnityARAnchorData ufad)
        {
            planeAnchorData = ufad;
#if !UNITY_WSA
            identifierStr = Marshal.PtrToStringAuto(planeAnchorData.ptrIdentifier);
#else
            identifierStr = null;
#endif
        }
Esempio n. 5
0
        public static UnityARAnchorData UnityARAnchorDataFromGameObject(GameObject go)
        {
            Matrix4x4         matrix4x = Matrix4x4.TRS(go.transform.position, go.transform.rotation, go.transform.localScale);
            UnityARAnchorData result   = default(UnityARAnchorData);

            result.transform.column0 = matrix4x.GetColumn(0);
            result.transform.column1 = matrix4x.GetColumn(1);
            result.transform.column2 = matrix4x.GetColumn(2);
            result.transform.column3 = matrix4x.GetColumn(3);
            return(result);
        }
Esempio n. 6
0
        public static UnityARAnchorData UnityARAnchorDataFromGameObject(GameObject go)
        {
            // create an anchor data struct from a game object transform
            Matrix4x4         matrix = Matrix4x4.TRS(go.transform.position, go.transform.rotation, go.transform.localScale);
            UnityARAnchorData ad     = new UnityARAnchorData();

            ad.transform.column0 = matrix.GetColumn(0);
            ad.transform.column1 = matrix.GetColumn(1);
            ad.transform.column2 = matrix.GetColumn(2);
            ad.transform.column3 = matrix.GetColumn(3);
            return(ad);
        }
Esempio n. 7
0
        private static ARPlaneAnchor GetPlaneAnchorFromAnchorData(UnityARAnchorData anchor)
        {
            ARPlaneAnchor result = default(ARPlaneAnchor);

            result.identifier = Marshal.PtrToStringAuto(anchor.ptrIdentifier);
            Matrix4x4 transform = default(Matrix4x4);

            transform.SetColumn(0, anchor.transform.column0);
            transform.SetColumn(1, anchor.transform.column1);
            transform.SetColumn(2, anchor.transform.column2);
            transform.SetColumn(3, anchor.transform.column3);
            result.transform = transform;
            result.alignment = anchor.alignment;
            result.center    = new Vector3(anchor.center.x, anchor.center.y, anchor.center.z);
            result.extent    = new Vector3(anchor.extent.x, anchor.extent.y, anchor.extent.z);
            return(result);
        }
Esempio n. 8
0
        static ARPlaneAnchor GetPlaneAnchorFromAnchorData(UnityARAnchorData anchor)
        {
            //get the identifier for this anchor from the pointer
            ARPlaneAnchor arPlaneAnchor = new ARPlaneAnchor();

            arPlaneAnchor.identifier = Marshal.PtrToStringAuto(anchor.ptrIdentifier);
            Matrix4x4 matrix = new Matrix4x4();

            matrix.SetColumn(0, anchor.transform.column0);
            matrix.SetColumn(1, anchor.transform.column1);
            matrix.SetColumn(2, anchor.transform.column2);
            matrix.SetColumn(3, anchor.transform.column3);
            arPlaneAnchor.transform = matrix;
            arPlaneAnchor.alignment = anchor.alignment;
            arPlaneAnchor.center    = new Vector3(anchor.center.x, anchor.center.y, anchor.center.z);
            arPlaneAnchor.extent    = new Vector3(anchor.extent.x, anchor.extent.y, anchor.extent.z);
            return(arPlaneAnchor);
        }
        static ARPlaneAnchor GetPlaneAnchorFromAnchorData(UnityARAnchorData anchor)
        {
            #if PLATFORM_IOS
            //get the identifier for this anchor from the pointer
            ARPlaneAnchor arPlaneAnchor = new ARPlaneAnchor();
            arPlaneAnchor.identifier = Marshal.PtrToStringAuto(anchor.ptrIdentifier);

            Matrix4x4 matrix = new Matrix4x4();
            matrix.SetColumn(0, anchor.transform.column0);
            matrix.SetColumn(1, anchor.transform.column1);
            matrix.SetColumn(2, anchor.transform.column2);
            matrix.SetColumn(3, anchor.transform.column3);

            arPlaneAnchor.transform = matrix;
            arPlaneAnchor.alignment = anchor.alignment;
            arPlaneAnchor.center    = new Vector3(anchor.center.x, anchor.center.y, anchor.center.z);
            arPlaneAnchor.extent    = new Vector3(anchor.extent.x, anchor.extent.y, anchor.extent.z);
            return(arPlaneAnchor);
            #else
            Debug.Log("Not available on non iOS platforms");
            return(new ARPlaneAnchor());
            #endif
        }
Esempio n. 10
0
 public ARPlaneAnchor(UnityARAnchorData ufad)
 {
     planeAnchorData = ufad;
 }
Esempio n. 11
0
 public ARPlaneAnchor(UnityARAnchorData ufad)
 {
     planeAnchorData = ufad;
     identifierStr   = Marshal.PtrToStringAuto(planeAnchorData.ptrIdentifier);
 }