-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathARImageAnchor.cs
60 lines (40 loc) · 1.42 KB
/
ARImageAnchor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.InteropServices;
namespace UnityEngine.XR.iOS
{
public struct UnityARImageAnchorData
{
public IntPtr ptrIdentifier;
/**
The transformation matrix that defines the anchor's rotation, translation and scale in world coordinates.
*/
public UnityARMatrix4x4 transform;
public IntPtr referenceImageNamePtr;
public float referenceImagePhysicalSize;
public int isTracked;
};
public class ARImageAnchor {
private UnityARImageAnchorData imageAnchorData;
public ARImageAnchor (UnityARImageAnchorData uiad)
{
imageAnchorData = uiad;
}
public string identifier { get { return Marshal.PtrToStringAuto(imageAnchorData.ptrIdentifier); } }
public bool isTracked { get {return imageAnchorData.isTracked != 0; } }
public Matrix4x4 transform {
get {
Matrix4x4 matrix = new Matrix4x4 ();
matrix.SetColumn (0, imageAnchorData.transform.column0);
matrix.SetColumn (1, imageAnchorData.transform.column1);
matrix.SetColumn (2, imageAnchorData.transform.column2);
matrix.SetColumn (3, imageAnchorData.transform.column3);
return matrix;
}
}
public string referenceImageName { get { return Marshal.PtrToStringAuto(imageAnchorData.referenceImageNamePtr); } }
public float referenceImagePhysicalSize { get { return imageAnchorData.referenceImagePhysicalSize; } }
}
}