Skip to content

Commit 7f754ff

Browse files
committed
MixedRealityPlacespace accessor returns Transform now
1 parent 1e237cf commit 7f754ff

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

Assets/MixedRealityToolkit-Examples/Demos/Boundary/Scripts/BoundaryVisualizationDemo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void Awake()
4444
{
4545
markerParent = new GameObject();
4646
markerParent.name = "Boundary Demo Markers";
47-
markerParent.transform.parent = MixedRealityManager.Instance.MixedRealityPlayspace.transform;
47+
markerParent.transform.parent = MixedRealityManager.Instance.MixedRealityPlayspace;
4848
}
4949

5050
private void Start()

Assets/MixedRealityToolkit-SDK/Features/Boundary/MixedRealityBoundaryManager.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public override void Destroy()
189189
private GameObject CreateBoundaryVisualizationParent()
190190
{
191191
GameObject visualizationParent = new GameObject("Boundary System Visualizations");
192-
visualizationParent.transform.parent = MixedRealityManager.Instance.MixedRealityPlayspace.transform;
192+
visualizationParent.transform.parent = MixedRealityManager.Instance.MixedRealityPlayspace;
193193

194194
return visualizationParent;
195195
}
@@ -456,7 +456,7 @@ public bool Contains(Vector3 location, Boundary.Type boundaryType = Boundary.Typ
456456
}
457457

458458
// Handle the user teleporting (boundary moves with them).
459-
location = MixedRealityManager.Instance.MixedRealityPlayspace.transform.InverseTransformPoint(location);
459+
location = MixedRealityManager.Instance.MixedRealityPlayspace.InverseTransformPoint(location);
460460

461461
if (FloorHeight.Value > location.y ||
462462
BoundaryHeight < location.y)
@@ -499,7 +499,7 @@ public bool TryGetRectangularBoundsParams(out Vector2 center, out float angle, o
499499
}
500500

501501
// Handle the user teleporting (boundary moves with them).
502-
Vector3 transformedCenter = MixedRealityManager.Instance.MixedRealityPlayspace.transform.TransformPoint(
502+
Vector3 transformedCenter = MixedRealityManager.Instance.MixedRealityPlayspace.TransformPoint(
503503
new Vector3(rectangularBounds.Center.x, 0f, rectangularBounds.Center.y));
504504

505505
center = new Vector2(transformedCenter.x, transformedCenter.z);
@@ -530,9 +530,9 @@ public GameObject GetFloorVisualization()
530530
currentFloorObject.name = "Boundary System Floor";
531531
currentFloorObject.transform.localScale = new Vector3(floorScale.x, boundaryObjectThickness, floorScale.y);
532532
currentFloorObject.transform.Translate(new Vector3(
533-
MixedRealityManager.Instance.MixedRealityPlayspace.transform.position.x,
533+
MixedRealityManager.Instance.MixedRealityPlayspace.position.x,
534534
FloorHeight.Value - (currentFloorObject.transform.localScale.y * 0.5f),
535-
MixedRealityManager.Instance.MixedRealityPlayspace.transform.position.z));
535+
MixedRealityManager.Instance.MixedRealityPlayspace.position.z));
536536
currentFloorObject.GetComponent<Renderer>().sharedMaterial = MixedRealityManager.Instance.ActiveProfile.BoundaryVisualizationProfile.FloorMaterial;
537537

538538
return currentFloorObject;
@@ -606,9 +606,9 @@ public GameObject GetTrackedAreaVisualization()
606606
currentTrackedAreaObject.layer = ignoreRaycastLayerValue;
607607
currentTrackedAreaObject.AddComponent<LineRenderer>();
608608
currentTrackedAreaObject.transform.Translate(new Vector3(
609-
MixedRealityManager.Instance.MixedRealityPlayspace.transform.position.x,
609+
MixedRealityManager.Instance.MixedRealityPlayspace.position.x,
610610
boundaryObjectRenderOffset,
611-
MixedRealityManager.Instance.MixedRealityPlayspace.transform.position.z));
611+
MixedRealityManager.Instance.MixedRealityPlayspace.position.z));
612612

613613
// Configure the renderer properties.
614614
float lineWidth = 0.01f;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ private void ProcessTeleportationRequest(TeleportEventData eventData)
238238
{
239239
isProcessingTeleportRequest = true;
240240

241-
var cameraParent = MixedRealityManager.Instance.MixedRealityPlayspace.transform;
241+
var cameraParent = MixedRealityManager.Instance.MixedRealityPlayspace;
242242

243243
targetRotation = Vector3.zero;
244244
targetRotation.y = eventData.Pointer.PointerOrientation;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public override void OnPositionInputChanged(InputEventData<Vector2> eventData)
303303
{
304304
canMove = false;
305305
// Rotate the camera by the rotation amount. If our angle is positive then rotate in the positive direction, otherwise in the opposite direction.
306-
MixedRealityManager.Instance.MixedRealityPlayspace.transform.RotateAround(CameraCache.Main.transform.position, Vector3.up, angle >= 0.0f ? rotationAmount : -rotationAmount);
306+
MixedRealityManager.Instance.MixedRealityPlayspace.RotateAround(CameraCache.Main.transform.position, Vector3.up, angle >= 0.0f ? rotationAmount : -rotationAmount);
307307
}
308308
else // We may be trying to strafe backwards.
309309
{
@@ -317,10 +317,10 @@ public override void OnPositionInputChanged(InputEventData<Vector2> eventData)
317317
if (offsetStrafeAngle > 0 && offsetStrafeAngle < backStrafeActivationAngle)
318318
{
319319
canMove = false;
320-
var height = MixedRealityManager.Instance.MixedRealityPlayspace.transform.position.y;
321-
var newPosition = -CameraCache.Main.transform.forward * strafeAmount + MixedRealityManager.Instance.MixedRealityPlayspace.transform.position;
320+
var height = MixedRealityManager.Instance.MixedRealityPlayspace.position.y;
321+
var newPosition = -CameraCache.Main.transform.forward * strafeAmount + MixedRealityManager.Instance.MixedRealityPlayspace.position;
322322
newPosition.y = height;
323-
MixedRealityManager.Instance.MixedRealityPlayspace.transform.position = newPosition;
323+
MixedRealityManager.Instance.MixedRealityPlayspace.position = newPosition;
324324
}
325325
}
326326
}

Assets/MixedRealityToolkit/_Core/Devices/BaseController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private void TryRenderControllerModel(Type controllerType)
203203
// If we've got a controller model prefab, then place it in the scene.
204204
if (controllerModel != null)
205205
{
206-
var controllerObject = UnityEngine.Object.Instantiate(controllerModel, MixedRealityManager.Instance.MixedRealityPlayspace.transform);
206+
var controllerObject = UnityEngine.Object.Instantiate(controllerModel, MixedRealityManager.Instance.MixedRealityPlayspace);
207207
controllerObject.name = $"{ControllerHandedness}_{controllerObject.name}";
208208
var poseSynchronizer = controllerObject.GetComponent<IMixedRealityControllerPoseSynchronizer>();
209209

Assets/MixedRealityToolkit/_Core/Devices/BaseDeviceManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected virtual IMixedRealityPointer[] RequestPointers(SystemType controllerTy
9999
{
100100
var pointerObject = Object.Instantiate(pointerProfile.PointerPrefab);
101101
var pointer = pointerObject.GetComponent<IMixedRealityPointer>();
102-
pointerObject.transform.SetParent(MixedRealityManager.Instance.MixedRealityPlayspace.transform);
102+
pointerObject.transform.SetParent(MixedRealityManager.Instance.MixedRealityPlayspace);
103103

104104
if (pointer != null)
105105
{

Assets/MixedRealityToolkit/_Core/Devices/MixedReality/WindowsMixedRealityController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ private void UpdateGripData(InteractionSourceState interactionSourceState, Mixed
243243
interactionSourceState.sourcePose.TryGetPosition(out currentGripPosition, InteractionSourceNode.Grip);
244244
interactionSourceState.sourcePose.TryGetRotation(out currentGripRotation, InteractionSourceNode.Grip);
245245

246-
if (MixedRealityManager.Instance.MixedRealityPlayspace.transform != null)
246+
if (MixedRealityManager.Instance.MixedRealityPlayspace != null)
247247
{
248-
currentGripPose.Position = MixedRealityManager.Instance.MixedRealityPlayspace.transform.TransformPoint(currentGripPosition);
249-
currentGripPose.Rotation = Quaternion.Euler(MixedRealityManager.Instance.MixedRealityPlayspace.transform.TransformDirection(currentGripRotation.eulerAngles));
248+
currentGripPose.Position = MixedRealityManager.Instance.MixedRealityPlayspace.TransformPoint(currentGripPosition);
249+
currentGripPose.Rotation = Quaternion.Euler(MixedRealityManager.Instance.MixedRealityPlayspace.TransformDirection(currentGripRotation.eulerAngles));
250250
}
251251
else
252252
{

Assets/MixedRealityToolkit/_Core/Managers/MixedRealityManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@ private void InitializeInternal()
341341
}
342342
}
343343

344-
private GameObject mixedRealityPlayspace;
344+
private Transform mixedRealityPlayspace;
345345

346346
/// <summary>
347347
/// Returns the MixedRealityPlayspace for the local player
348348
/// </summary>
349-
public GameObject MixedRealityPlayspace
349+
public Transform MixedRealityPlayspace
350350
{
351351
get {
352352
AssertIsInitialized();
@@ -356,8 +356,8 @@ public GameObject MixedRealityPlayspace
356356
}
357357
else
358358
{
359-
mixedRealityPlayspace = new GameObject("MixedRealityPlayspace");
360-
CameraCache.Main.transform.SetParent(mixedRealityPlayspace.transform);
359+
mixedRealityPlayspace = new GameObject("MixedRealityPlayspace").transform;
360+
CameraCache.Main.transform.SetParent(mixedRealityPlayspace);
361361

362362
// It's very important that the MixedRealityPlayspace align with the tracked space,
363363
// otherwise reality-locked things like playspace boundaries won't be aligned properly.

0 commit comments

Comments
 (0)