AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
RestrictToBounds.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity
7 {
11  [RequireComponent(typeof(Transform))]
12  public class RestrictToBounds : MonoBehaviour
13  {
14  public Vector3 Min;
15  public Vector3 Max;
16 
17  void Update()
18  {
19  this.transform.localPosition = MathExtensions.ClampComponentwise(this.transform.localPosition, this.Min, this.Max);
20  }
21  }
22 }
Extension methods and helper functions for various math data
Keeps a game object within configured bounds
static Vector3 ClampComponentwise(Vector3 value, Vector3 min, Vector3 max)