Skip to main content
New Participant
September 30, 2021
Solved

OVRCustomHands trigger collider

  • September 30, 2021
  • 4 replies
  • 2500 views

Hi everyone,

using Oculus Integration and OVRCustomHand prefab, I'm trying to write a simple script that tells me which hand hitted/triggered a specific object.

I tried use OnTriggerEnter() method, but the referred collider (CapsuleCollider) doesn't have any information of the hand.

 

What do you suggest I do?

 

Thanks in advance.

 

    This topic has been closed for replies.
    Best answer by laurisD

    Ok I got it, it worked for me :

    the name of the hand colliding can be found in your Ontrigger method under : other.GetComponentInParent<OVRSkeleton>().GetSkeletonType()

    NB : it return a string

    if it work for you, mark this as a solution it would help me 😉 

    4 replies

    Participant
    October 1, 2021

    Hi,

    For get the Hand information you should just write :

    private string NameOfTheHand;
    
    Void OnTriggerEnter(collider other)
    {
    NameOfTheHand = other.gameObject.name;
    Debug.Log("Don't forget to give LaurisD a Kudo");
    }

     then you can compare the name in a switch or a if loop for do what you want.

    Hope I helped you 😉

    aleclockAuthor
    New Participant
    October 1, 2021

    Thanks for your reply, but that's not true actually.

    Each bone's CapsuleCollider seems to be created at runtime and it's not directly attached to the hand's prefab. So other.gameObject.name returns the collider itself and not the hand's prefab.

    laurisDAnswer
    Participant
    October 1, 2021

    Ok I got it, it worked for me :

    the name of the hand colliding can be found in your Ontrigger method under : other.GetComponentInParent<OVRSkeleton>().GetSkeletonType()

    NB : it return a string

    if it work for you, mark this as a solution it would help me 😉