Skip to content

Instantly share code, notes, and snippets.

@benmcnelly
Created April 11, 2017 23:53
Show Gist options
  • Save benmcnelly/dde445a802c1ef49c2dde3ee504c4ed2 to your computer and use it in GitHub Desktop.
Save benmcnelly/dde445a802c1ef49c2dde3ee504c4ed2 to your computer and use it in GitHub Desktop.
using UnityEngine;
using VRTK;
public class theRealDonaldTrump : MonoBehaviour {
void Start ()
{
//Does the thing being grabbed ( Mexican ) have the interactable object VRTK script attached...
if (GetComponent<VRTK_InteractableObject>() == null)
{
Debug.LogError("You can't grab this, it has obtained legal citizenship, also needs VRTK_InteractableObject script attached to it");
return;
}
//subscribe to the event....
GetComponent<VRTK_InteractableObject>().InteractableObjectGrabbed += new InteractableObjectEventHandler(ObjectGrabbed);
}
//this object has been grabbed.. Lets deport this..
private void ObjectGrabbed(object sender, InteractableObjectEventArgs e)
{
Debug.Log("Target got grabbed!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment