void remove_plane(ARKitStream.ARKitPlane plane) { if (planes.ContainsKey(plane.identifier)) { GameObject go = planes[plane.identifier]; GameObject.Destroy(go); planes.Remove(plane.identifier); } }
void update_plane(ARKitStream.ARKitPlane plane) { if (planes.ContainsKey(plane.identifier) == false) { GameObject plane_go = GameObject.CreatePrimitive(PrimitiveType.Plane); plane_go.name = "plane-" + plane.identifier; planes[plane.identifier] = plane_go; plane_go.transform.SetParent(planes_parent.transform, true); plane_go.transform.localScale = 0.1f * Vector3.one; if (PlaneMaterial != null) { plane_go.GetComponent <Renderer>().material = PlaneMaterial; } } GameObject go = planes[plane.identifier]; go.transform.position = plane.position; go.transform.rotation = plane.orientation; go.transform.position += plane.orientation * plane.center; go.transform.localScale = new Vector3(0.1f * plane.extents.x, 1, 0.1f * plane.extents.z); }