Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed OptimizeSceneForDeviceType #1309

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
using HoloToolkit.Unity;
using System.Collections.Generic;

using System;
using UnityEngine;
using UnityEngine.XR.WSA;

namespace HoloToolkit.Unity.Examples
{
[Obsolete("Use SceneContentAdjuster")]
public class OptimizeSceneforDeviceType : MonoBehaviour
{
public GameObject containerObject;

void Start()
{
// Check if the device type is HoloLens or Immersive HMD
if (HolographicSettings.IsDisplayOpaque)
{
// Optimize the default postion of the objects for Immersive HMD
containerObject.transform.position = new Vector3(0.05f, 1.2f, 1.08f);

}
else
{
// Optimize the default postion of the objects for HoloLens
containerObject.transform.position = new Vector3(0.05f, -0.65f, 1.65f);

// Remove skybox for HoloLens
RenderSettings.skybox = null;
}
}

}
}
19 changes: 16 additions & 3 deletions Assets/HoloToolkit/Boundary/Scripts/SceneContentAdjuster.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using HoloToolkit.Unity.Boundary;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;

#if UNITY_2017_2_OR_NEWER
using HoloToolkit.Unity.Boundary;
using UnityEngine.XR;
#else
using UnityEngine.VR;
Expand All @@ -12,13 +15,23 @@ public class SceneContentAdjuster : MonoBehaviour
private Vector3 lastFloorHeight;
private float floorHeightOffset = 1f;

[SerializeField]
[Tooltip("Optional container object reference. If null, this script will move the object it's attached to.")]
private Transform containerObject;


private void Awake()
{
if (containerObject == null)
{
containerObject = transform;
}

#if UNITY_2017_2_OR_NEWER
if (Application.isEditor && XRDevice.isPresent)
{
lastFloorHeight.y = floorHeightOffset;
transform.position = lastFloorHeight;
containerObject.position = lastFloorHeight;
}
#else
if (VRDevice.isPresent)
Expand All @@ -38,7 +51,7 @@ private void Update()
if (lastFloorHeight.y != floorHeightOffset)
{
lastFloorHeight.y = floorHeightOffset;
transform.position = lastFloorHeight;
containerObject.position = lastFloorHeight;
}
}
#endif
Expand Down