I have interactable/throwable
VR objects in my game. The thing is that when I hold this object in hand and move him in area of other object trigger I want to force detach this object from hand.
public void DetachFromHand() //Added method in Interactable.cs
{
OnDetachedFromHand(attachedToHand);
}
private void OnTriggerEnter(Collider other)
{
other.gameObject.GetComponent<Valve.VR.InteractionSystem.Interactable>().DetachFromHand();
}
GetComponent<Valve.VR.InteractionSystem.Interactable>()
returns null even though object I hold has Interactable
script added.
What's more I think this isn't the best way to solve this problem.