Skip to content

Commit b63ebd8

Browse files
Merge branch 'mrtk_development' into vNEXT-ControllerRendering
2 parents 5a39987 + fa69eb9 commit b63ebd8

File tree

4 files changed

+31
-46
lines changed

4 files changed

+31
-46
lines changed

Assets/MixedRealityToolkit-SDK/Features/Teleportation/MixedRealityTeleportManager.cs

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ public class MixedRealityTeleportManager : MixedRealityEventManager, IMixedReali
2121
private bool isTeleporting = false;
2222
private bool isProcessingTeleportRequest = false;
2323

24-
private Vector3 startRotation = Vector3.zero;
25-
2624
private Vector3 targetPosition = Vector3.zero;
2725
private Vector3 targetRotation = Vector3.zero;
2826

@@ -181,17 +179,13 @@ public void RaiseTeleportStarted(IMixedRealityPointer pointer, IMixedRealityTele
181179
handler.OnTeleportCompleted(casted);
182180
};
183181

184-
/// <inheritdoc />
185-
public void RaiseTeleportComplete(IMixedRealityPointer pointer, IMixedRealityTeleportHotSpot hotSpot)
182+
/// <summary>
183+
/// Raise a teleportation completed event.
184+
/// </summary>
185+
/// <param name="pointer">The pointer that raised the event.</param>
186+
/// <param name="hotSpot">The teleport target</param>
187+
private void RaiseTeleportComplete(IMixedRealityPointer pointer, IMixedRealityTeleportHotSpot hotSpot)
186188
{
187-
// Check to make sure no one from outside the Teleport System called this method.
188-
// Other implementations may have a different way of processing requests.
189-
if (isProcessingTeleportRequest)
190-
{
191-
Debug.LogError("Calls to this method from outside the Teleport System is not allowed in this implementation.");
192-
return;
193-
}
194-
195189
if (!isTeleporting)
196190
{
197191
Debug.LogError("No Active Teleportation in progress.");
@@ -232,27 +226,26 @@ private void ProcessTeleportationRequest(TeleportEventData eventData)
232226

233227
var cameraParent = CameraCache.Main.transform.parent;
234228

235-
startRotation = CameraCache.Main.transform.eulerAngles;
236-
startRotation.x = 0f;
237-
startRotation.z = 0f;
238-
239-
cameraParent.eulerAngles = startRotation;
229+
targetRotation = Vector3.zero;
230+
targetRotation.y = eventData.Pointer.PointerOrientation;
231+
targetPosition = eventData.Pointer.Result.Details.Point;
240232

241233
if (eventData.HotSpot != null)
242234
{
243235
targetPosition = eventData.HotSpot.Position;
244-
targetRotation.y = eventData.HotSpot.OverrideTargetOrientation
245-
? eventData.HotSpot.TargetOrientation
246-
: eventData.Pointer.PointerOrientation;
247-
}
248-
else
249-
{
250-
targetPosition = eventData.Pointer.Result.Details.Point;
251-
targetRotation.y = eventData.Pointer.PointerOrientation;
236+
237+
if (eventData.HotSpot.OverrideTargetOrientation)
238+
{
239+
targetRotation.y = eventData.HotSpot.TargetOrientation;
240+
}
252241
}
253242

243+
float height = targetPosition.y;
244+
targetPosition -= CameraCache.Main.transform.position - cameraParent.position;
245+
targetPosition.y = height;
254246
cameraParent.position = targetPosition;
255-
cameraParent.eulerAngles = targetRotation;
247+
248+
cameraParent.RotateAround(CameraCache.Main.transform.position, Vector3.up, targetRotation.y - CameraCache.Main.transform.eulerAngles.y);
256249

257250
isProcessingTeleportRequest = false;
258251

Assets/MixedRealityToolkit-SDK/Features/UX/Prefabs/Pointers/ParabolicPointer.prefab

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,16 @@ MonoBehaviour:
259259
m_Name:
260260
m_EditorClassIdentifier:
261261
handedness: 1
262-
destroyOnLost: 1
262+
disableChildren: 1
263+
destroyOnSourceLost: 1
264+
cursorPrefab: {fileID: 1554777696564956, guid: 1934d37f8a23e204a8eef74d71cf626b,
265+
type: 2}
266+
raycastOrigin: {fileID: 0}
263267
useSourcePoseData: 0
264-
poseAction:
268+
inputSourceAction:
265269
id: 4
266270
description: Pointer Pose
267271
axisConstraint: 7
268-
cursorPrefab: {fileID: 1554777696564956, guid: 1934d37f8a23e204a8eef74d71cf626b,
269-
type: 2}
270-
raycastOrigin: {fileID: 0}
271272
activeHoldAction:
272273
id: 0
273274
description: None
@@ -435,7 +436,7 @@ MonoBehaviour:
435436
description: Teleport
436437
axisConstraint: 4
437438
activationAngle: 45
438-
angleOffset: -90
439+
angleOffset: 90
439440
upDirectionThreshold: 0.2
440441
LineColorHotSpot:
441442
serializedVersion: 2

Assets/MixedRealityToolkit-SDK/Features/UX/Scripts/Pointers/TeleportPointer.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public class TeleportPointer : LinePointer
3232

3333
[SerializeField]
3434
[Tooltip("Layers that are considered 'valid' for navigation")]
35-
protected LayerMask ValidLayers = 1 << 0; // Default
35+
protected LayerMask ValidLayers = Physics.DefaultRaycastLayers;
3636

3737
[SerializeField]
3838
[Tooltip("Layers that are considered 'invalid' for navigation")]
39-
protected LayerMask InvalidLayers = 1 << 2; // Ignore raycast
39+
protected LayerMask InvalidLayers = Physics.IgnoreRaycastLayer;
4040

4141
[SerializeField]
4242
private float inputThreshold = 0.5f;
@@ -81,6 +81,7 @@ public override void SetCursor(GameObject newCursor = null)
8181
base.SetCursor(newCursor);
8282
BaseCursor?.SetVisibility(false);
8383
}
84+
8485
#region IMixedRealityPointer Implementation
8586

8687
/// <inheritdoc />
@@ -102,7 +103,7 @@ public override float PointerOrientation
102103
}
103104
set
104105
{
105-
base.PointerOrientation = value * -1f;
106+
base.PointerOrientation = value;
106107
}
107108
}
108109

@@ -245,7 +246,7 @@ public override void OnPositionInputChanged(InputEventData<Vector2> eventData)
245246
Mathf.Abs(currentInputPosition.x) > inputThreshold)
246247
{
247248
// Get the angle of the pointer input
248-
float angle = Mathf.Atan2(currentInputPosition.y, currentInputPosition.x) * Mathf.Rad2Deg;
249+
float angle = -Mathf.Atan2(currentInputPosition.y, currentInputPosition.x) * Mathf.Rad2Deg;
249250

250251
// Offset the angle so it's 'forward' facing
251252
angle += angleOffset;
@@ -260,9 +261,6 @@ public override void OnPositionInputChanged(InputEventData<Vector2> eventData)
260261
}
261262
else
262263
{
263-
currentInputPosition = Vector2.zero;
264-
PointerOrientation = 0f;
265-
266264
if (canTeleport)
267265
{
268266
canTeleport = false;

Assets/MixedRealityToolkit/_Core/Interfaces/TeleportSystem/IMixedRealityTeleportSystem.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ public interface IMixedRealityTeleportSystem : IMixedRealityEventSystem
3131
/// <param name="hotSpot">The teleport target</param>
3232
void RaiseTeleportStarted(IMixedRealityPointer pointer, IMixedRealityTeleportHotSpot hotSpot);
3333

34-
/// <summary>
35-
/// Raise a teleportation completed event.
36-
/// </summary>
37-
/// <param name="pointer">The pointer that raised the event.</param>
38-
/// <param name="hotSpot">The teleport target</param>
39-
void RaiseTeleportComplete(IMixedRealityPointer pointer, IMixedRealityTeleportHotSpot hotSpot);
40-
4134
/// <summary>
4235
/// Raise a teleportation canceled event.
4336
/// </summary>

0 commit comments

Comments
 (0)