void UpdatePlane(ARPlane arPlane) { var plane = arPlane.ToMRPlane(); var id = this.AddOrUpdateData(plane); this.AddOrUpdateTrait(id, TraitNames.Pose, plane.pose); this.AddOrUpdateTrait(id, TraitNames.Bounds2D, plane.extents); if (planeUpdated != null) { planeUpdated(plane); } }
void RemovePlane(ARPlane arPlane) { var plane = arPlane.ToMRPlane(); var id = this.RemoveData(plane); this.RemoveTrait <bool>(id, TraitNames.Plane); this.RemoveTrait <Pose>(id, TraitNames.Pose); this.RemoveTrait <Vector2>(id, TraitNames.Bounds2D); this.RemoveTrait <int>(id, TraitNames.Alignment); if (planeRemoved != null) { planeRemoved(plane); } }
void AddPlane(ARPlane arPlane) { var plane = arPlane.ToMRPlane(); var id = this.AddOrUpdateData(plane); var worldCenter = plane.pose.position + (plane.pose.rotation * plane.center); var centerPose = new Pose(worldCenter, plane.pose.rotation); this.AddOrUpdateTrait(id, TraitNames.Plane, true); this.AddOrUpdateTrait(id, TraitNames.Pose, centerPose); this.AddOrUpdateTrait(id, TraitNames.Bounds2D, plane.extents); this.AddOrUpdateTrait(id, TraitNames.Alignment, (int)plane.alignment); if (planeAdded != null) { planeAdded(plane); } }