AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
GrabbableChild.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.InputModule.Examples.Grabbables
7 {
13  {
14  protected override void StartGrab(BaseGrabber grabber)
15  {
16  base.StartGrab(grabber);
17 
18  transform.SetParent(GrabberPrimary.transform);
19  gameObject.GetComponent<Rigidbody>().isKinematic = true;
20  }
21 
22  protected override void EndGrab()
23  {
24  transform.SetParent(null);
25  gameObject.GetComponent<Rigidbody>().isKinematic = false;
26  base.EndGrab();
27  }
28 
29  protected override void AttachToGrabber(BaseGrabber grabber)
30  {
31  GetComponent<Rigidbody>().isKinematic = true;
32  if (!activeGrabbers.Contains(grabber))
33  activeGrabbers.Add(grabber);
34  }
35 
36  protected override void DetachFromGrabber(BaseGrabber grabber)
37  {
38  GetComponent<Rigidbody>().isKinematic = false;
39  GetComponent<Rigidbody>().useGravity = true;
40  }
41  }
42 }
override void EndGrab()
Grab end fires off a GrabEnded event, but also cleans up some of the variables associated with an act...
Intended usage: scripts that inherit from this can be attached to the controller, or any object with ...
Definition: BaseGrabber.cs:18
//Intended Usage// Attach a "grabbable_x" script (a script that inherits from this) to any object tha...
This type of grab makes the grabbed object a child of the grabber. This ensures a grabbed object perf...