public void CorrectWithAnchor(WallMarker marker) { Debug.Log("CorrectWithAnchor"); Debug.Log(marker.Anchor); if (marker != null) { var targetAnchor = marker.Anchor; var stageAnchor = marker.TargetAnchor; stageAnchor.SetParent(transform.parent); transform.SetParent(stageAnchor); //why rotates on even corrections?????????????????????? stageAnchor.SetPositionAndRotation(targetAnchor.position, targetAnchor.rotation); transform.SetParent(stageAnchor.parent); stageAnchor.SetParent(transform); Debug.Log(Center.position); Debug.Log(Center.rotation); //var player = FindObjectOfType<Controller>(); // var corrPos = transform.InverseTransformPoint() //player.SetCorrection(-Center.position, Quaternion.Inverse(Center.rotation)); } }
public void Start() { text = GetComponentInChildren <UnityEngine.UI.Text>(); bg = GetComponentInChildren <UnityEngine.UI.Image>(); marker = transform.parent.GetComponent <Tracking.WallMarker>(); setText(marker.gameObject.name); }
private void OnMarkerLost(WallMarker marker) { _currentAnchors.Remove(marker); if (marker == _mainAnchor) { if (_currentAnchors.Count > 0) { // make another anchor main _mainAnchor = _currentAnchors[_currentAnchors.Count - 1]; updateHighlight(); } } }
/*public void StartLocalization() * { * if (_coroutineLocalization != null) * { * StopCoroutine(_coroutineLocalization); * } * _coroutineLocalization = StartCoroutine(Localization()); * return; * }*/ private void OnMarkerDetected(WallMarker marker) { if (Stage.activeSelf && !_inPlace) { //FindObjectOfType<GameManager>().PlayerReady(); _inPlace = true; } _currentAnchors.Add(marker); // if (_currentAnchor == null) { TrackableWorld.CorrectWithAnchor(marker); _mainAnchor = marker; updateHighlight(); // } }
private void OnMarkerUpdate(WallMarker marker) { TrackableWorld.CorrectWithAnchor(marker); updateHighlight(); }