AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
MoveObjectSelectWidget.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 
5 using System.Collections;
6 using System.Collections.Generic;
7 using UnityEngine;
8 
9 namespace HoloToolkit.Examples.InteractiveElements
10 {
14  [RequireComponent(typeof(MoveToPosition))]
16  {
17  [Tooltip("Default position for the default state")]
18  public Vector3 DefaultPosition;
19 
20  [Tooltip("Position for the selected state")]
21  public Vector3 SelectPosition;
22 
23  private MoveToPosition mMoveToPosition;
24 
28  void Awake()
29  {
30  mMoveToPosition = GetComponent<MoveToPosition>();
31  }
32 
37  public override void SetState(Interactive.ButtonStateEnum state)
38  {
39  base.SetState(state);
40 
41  if (mMoveToPosition != null)
42  {
43  if (state == Interactive.ButtonStateEnum.FocusSelected || state == Interactive.ButtonStateEnum.Selected || state == Interactive.ButtonStateEnum.PressSelected || state == Interactive.ButtonStateEnum.DisabledSelected)
44  {
45  mMoveToPosition.TargetValue = SelectPosition;
46  mMoveToPosition.StartRunning();
47  }
48  else
49  {
50  mMoveToPosition.TargetValue = DefaultPosition;
51  mMoveToPosition.StartRunning();
52  }
53  }
54  }
55  }
56 }
override void SetState(Interactive.ButtonStateEnum state)
Animate the position
InteractiveState can exist on a child element of the game object containing the Interactive component...
Changes the position of an element based on the Interactive selected state
A position animation component that supports easing and local position The animation can be triggered...
ButtonStateEnum
A button typically has 8 potential states. We can update visual feedback based on state change...
Definition: Interactive.cs:80
Interactive exposes basic button type events to the Unity Editor and receives messages from the Gestu...
Definition: Interactive.cs:22