Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ssshake/3d75b7c063e44759f1ff6553c883f937 to your computer and use it in GitHub Desktop.
Save ssshake/3d75b7c063e44759f1ff6553c883f937 to your computer and use it in GitHub Desktop.
//Adding this here because I couldn't figure out how to tell my grabble items in a game world when it's been grabbed
//so that it could do something on grab or release. Such as play a sound effect.
//
//After a lot of document searching I was surprised that I couldn't find what I was looking for.
//
//This extends OVRGrabble from the Oculus Unity SDK.
//You override methods called on grab
//You do your custom work
//You then pass the attributes on to OVRGrabble because it still needs these to do its own piece of work
using UnityEngine;
namespace Daggasoft
{
public abstract class DaggasoftGrabbable : OVRGrabbable
{
override public void GrabBegin(OVRGrabber hand, Collider grabPoint)
{
Debug.Log("DAGGASOFT: GRAB BEGIN");
//Your code goes here
base.GrabBegin(hand, grabPoint); //pass attributes down to Super
}
override public void GrabEnd(Vector3 linearVelocity, Vector3 angularVelocity)
{
Debug.Log("DAGGASOFT: GRAB END");
//Your code goes here
base.GrabEnd(linearVelocity, angularVelocity);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment