AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
TestRotationConstraints.cs
Go to the documentation of this file.
1 using UnityEngine;
3 
4 namespace HoloToolkit.Unity.InputModule.Tests
5 {
10  [RequireComponent(typeof(TwoHandManipulatable))]
11  public class TestRotationConstraints : MonoBehaviour, IInputClickHandler
12  {
16  [SerializeField]
17  private TextMesh descriptionText = null;
21  private TwoHandManipulatable twoHandManipulatable;
22 
23  private const string DescriptionPrefix = "Rotate\n";
24  private const string XAxisConstraint = "X axis Constraint";
25  private const string YAxisConstraint = "Y axis Constraint";
26  private const string DescriptionPostfix = "\nTap on the model to toggle between X and Y constraints";
27 
28  // Use this for initialization
29  private void Start()
30  {
31  twoHandManipulatable = GetComponent<TwoHandManipulatable>();
32  }
33 
34  public void OnInputClicked(InputClickedEventData eventData)
35  {
36  if (twoHandManipulatable != null)
37  {
38  bool isXAxisConstraint = twoHandManipulatable.RotationConstraint == AxisConstraint.XAxisOnly;
39  twoHandManipulatable.RotationConstraint = isXAxisConstraint ? AxisConstraint.YAxisOnly : AxisConstraint.XAxisOnly;
40  if (descriptionText != null)
41  {
42  descriptionText.text = DescriptionPrefix + (isXAxisConstraint ? YAxisConstraint : XAxisConstraint) + DescriptionPostfix;
43  }
44  }
45  }
46  }
47 }
This script allows for an object to be movable, scalable, and rotatable with one or two hands...
Interface to implement to react to simple click input.
Test MonoBehaviour that can be attached to any game object which has TwoHandManipulatable(with Manipu...
Describes an input event that involves a tap.