void MarkerUpdatedHandler(MRMarker marker) { if (m_MarkerPrefab) { CreateOrUpdateGameObject(marker); } }
void MarkerRemovedHandler(MRMarker marker) { GameObject go; if (m_MarkerGameObjects.TryGetValue(marker.id, out go)) { UnityObjectUtils.Destroy(go); m_MarkerGameObjects.Remove(marker.id); } }
public static MRMarker ToMRMarker(this ARTrackedImage trackedImage) { var mrMarker = new MRMarker { id = trackedImage.trackableId.ToMarsId(), pose = trackedImage.transform.GetWorldPose(), markerId = trackedImage.referenceImage.guid, extents = trackedImage.extents, trackingState = ArfTrackingStateToMars(trackedImage.trackingState) }; return(mrMarker); }
XRTrackedImage TrackedImageFromMRMarker(MRMarker mrMarker) { Guid guid; var path = AssetDatabase.GetAssetPath(mrMarker.texture); var textureGuid = Guid.Parse(AssetDatabase.AssetPathToGUID(path)); m_MarkerGuids.TryGetValue(textureGuid, out guid); return(new XRTrackedImage(new TrackableId(mrMarker.id.subId1, mrMarker.id.subId2), guid, mrMarker.pose, mrMarker.extents, ToArfTrackingState(mrMarker.trackingState), IntPtr.Zero)); }
void CreateOrUpdateGameObject(MRMarker marker) { if (MARSCore.instance.paused) { return; } GameObject go; var id = marker.id; if (!m_MarkerGameObjects.TryGetValue(id, out go)) { go = Instantiate(m_MarkerPrefab, transform); m_MarkerGameObjects.Add(id, go); } var goTransform = go.transform; var pose = this.ApplyOffsetToPose(marker.pose); goTransform.SetWorldPose(pose); goTransform.localScale = this.GetCameraScale() * Vector3.one; }
void MarkerRemoved(MRMarker marker) { m_Removed.Add(marker.id); }
void MarkerUpdated(MRMarker marker) { m_Updated[marker.id] = marker; }
void MarkerAdded(MRMarker marker) { m_Added.Add(marker); }