/// <inheritdoc /> public override bool TryCreateLocalizationSession(IPeerConnection peerConnection, MarkerVisualLocalizationSettings settings, out ISpatialLocalizationSession session) { session = null; if (markerVisual == null) { markerVisualGameObject = Instantiate(MarkerVisualPrefab); markerVisual = markerVisualGameObject.GetComponentInChildren <IMarkerVisual>(); if (markerVisual == null) { Debug.LogError("Marker Visual Prefab did not contain an IMarkerVisual component."); return(false); } } if (cameraTransform == null) { cameraTransform = Camera.main.transform; if (cameraTransform == null) { Debug.LogError("Unable to determine camera's location in the scene."); return(false); } } session = new LocalizationSession(this, settings, peerConnection, debugLogging); return(true); }
public MarkerVisualCoordinateService(IMarkerVisual markerVisual, UnityEngine.Matrix4x4 cameraToMarker, UnityEngine.Transform cameraTransform, bool debugLogging = false) { this.markerVisual = markerVisual ?? throw new ArgumentNullException("MarkerVisual was null."); this.cameraToMarker = cameraToMarker; this.cameraTransform = cameraTransform; this.debugLogging = debugLogging; DebugLog("Service Created"); }
protected void Awake() { if (_parentCanvas == null) { Debug.LogError("Parent canvas not defined for MarkerVisualCanvasSizeScraper"); return; } _markerVisual = MarkerVisual as IMarkerVisual; if (_markerVisual == null) { Debug.LogError("IMarkerVisual not defined for MarkerVisualCanvasSizeScraper"); return; } Debug.Log("MarkerVisual found to have parent canvas with scale factor of: " + _parentCanvas.scaleFactor); _markerVisual.TrySetScaleFactor(1.0f / _parentCanvas.scaleFactor); }
public SpatialCoordinate(int id, IMarkerVisual markerVisual) : base(id) { this.markerVisual = markerVisual; }