Skip to content

Commit 98805c6

Browse files
author
Stephen Hodgson
committed
Updated MRTeleport script
1 parent 7d34e64 commit 98805c6

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Assets/HoloToolkit/Input/Scripts/Utilities/Managers/MixedRealityTeleport.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class MixedRealityTeleport : Singleton<MixedRealityTeleport>, IController
3737
public float RotationSize = 45.0f;
3838
public float StrafeAmount = 0.5f;
3939

40-
public GameObject TeleportMarker;
40+
public GameObject TeleportMarker { get; private set; }
4141
private Animator animationController;
4242

4343
/// <summary>
@@ -46,7 +46,6 @@ public class MixedRealityTeleport : Singleton<MixedRealityTeleport>, IController
4646
/// </summary>
4747
private FadeScript fadeControl;
4848

49-
private GameObject teleportMarker;
5049
private bool isTeleportValid;
5150
private IPointingSource currentPointingSource;
5251
private uint currentSourceId;
@@ -66,12 +65,12 @@ private void Start()
6665
return;
6766
}
6867

69-
if (teleportMarker != null)
68+
if (TeleportMarker != null)
7069
{
71-
teleportMarker = Instantiate(TeleportMarker);
72-
teleportMarker.SetActive(false);
70+
TeleportMarker = Instantiate(TeleportMarker);
71+
TeleportMarker.SetActive(false);
7372

74-
animationController = teleportMarker.GetComponentInChildren<Animator>();
73+
animationController = TeleportMarker.GetComponentInChildren<Animator>();
7574
if (animationController != null)
7675
{
7776
animationController.StopPlayback();
@@ -209,7 +208,7 @@ private void FinishTeleport()
209208
if (isTeleportValid)
210209
{
211210
RaycastHit hitInfo;
212-
Vector3 hitPos = teleportMarker.transform.position + Vector3.up * (Physics.Raycast(Camera.main.transform.position, Vector3.down, out hitInfo, 5.0f) ? hitInfo.distance : 2.6f);
211+
Vector3 hitPos = TeleportMarker.transform.position + Vector3.up * (Physics.Raycast(CameraCache.Main.transform.position, Vector3.down, out hitInfo, 5.0f) ? hitInfo.distance : 2.6f);
213212

214213
fadeControl.DoFade(0.25f, 0.5f, () =>
215214
{
@@ -266,7 +265,7 @@ public void SetWorldPosition(Vector3 worldPosition)
266265

267266
private void EnableMarker()
268267
{
269-
teleportMarker.SetActive(true);
268+
TeleportMarker.SetActive(true);
270269
if (animationController != null)
271270
{
272271
animationController.StartPlayback();
@@ -279,7 +278,7 @@ private void DisableMarker()
279278
{
280279
animationController.StopPlayback();
281280
}
282-
teleportMarker.SetActive(false);
281+
TeleportMarker.SetActive(false);
283282
}
284283

285284
private void PositionMarker()
@@ -290,7 +289,7 @@ private void PositionMarker()
290289
{
291290
isTeleportValid = true;
292291

293-
teleportMarker.transform.position = focusDetails.Point;
292+
TeleportMarker.transform.position = focusDetails.Point;
294293
}
295294
else
296295
{

0 commit comments

Comments
 (0)