Skip to content

Instantly share code, notes, and snippets.

@takoyakiroom
Last active September 15, 2020 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takoyakiroom/a3c71513e9392c7d6bd8993679ba39b3 to your computer and use it in GitHub Desktop.
Save takoyakiroom/a3c71513e9392c7d6bd8993679ba39b3 to your computer and use it in GitHub Desktop.
ColliderChanger
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Valve.VR.InteractionSystem
{
public class ColliderChanger : MonoBehaviour
{
private void OnHandHoverBegin(Hand hand)
{
Debug.Log("OnHandHoverBegin:" + gameObject.name + "/handType:" + hand.handType);
//if(hand.handType == SteamVR_Input_Sources.RightHand)
//{
// Debug.Log("OnHandHoverBegin:RightHand");
//}
//else if (hand.handType == SteamVR_Input_Sources.LeftHand)
//{
// Debug.Log("OnHandHoverBegin:LeftHand");
//}
}
private void OnHandHoverEnd(Hand hand)
{
Debug.Log("OnHandHoverEnd:" + gameObject.name + "/handType:" + hand.handType);
}
private void OnAttachedToHand(Hand hand)
{
Debug.Log("OnAttachedToHand:" + gameObject.name + "/handType:" + hand.handType);
GetComponent<Collider>().isTrigger = true;
}
private void OnDetachedFromHand(Hand hand)
{
Debug.Log("OnDetachedFromHand:" + gameObject.name + "/handType:" + hand.handType);
GetComponent<Collider>().isTrigger = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment