AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
PanelTransformSize.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 System.Collections;
5 using System.Collections.Generic;
6 using UnityEngine;
7 
8 namespace HoloToolkit.Examples.Prototyping
9 {
24  [ExecuteInEditMode]
25  public class PanelTransformSize : MonoBehaviour
26  {
27  [Tooltip("A pixel to Unity unit conversion, Default: 2048x2048 pixels covers a 1x1 Unity Unit or default primitive size")]
28  public float BasePixelScale = 2048;
29 
30  [Tooltip("Size of the primitive using pixel values from our design program.")]
31  public Vector3 ItemSize = new Vector3(594, 246, 15);
32 
36  private void UpdateSize()
37  {
38  Vector3 newScale = new Vector3(ItemSize.x / BasePixelScale, ItemSize.y / BasePixelScale, ItemSize.z / BasePixelScale);
39  transform.localScale = newScale;
40  }
41 
42  // Update is called once per frame
43  void Update()
44  {
45  UpdateSize();
46  }
47  }
48 }
Takes size values, similar to RectTransorm size values or pixel values used in designer tools and app...