Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

How to know ViveRole in AfterGrabbed Event


AlGolden
 Share

Recommended Posts

Hi, could you please recommend the best way to get ViveRole during AfterGrabbed Event.

The task - i get the drill with left or right hand. I need to switch vibration on left or right hand inside AfterGrabbed() function. How can I know what hand is holding the drill?

I wanted to use BasicGrabbable.currentGrabber but it seems it is not the link to the hand gameObject.

What is the right method  to get ViveRole to call ViveInput.TriggerHapticVibration? @chengnay

Link to comment
Share on other sites

  • 1 month later...

@AlGoldenwere you able to resolve? For others asking about this:
 

    public void OnGrabbed(BasicGrabbable grabbedObj)
    {
        ViveColliderButtonEventData viveEventData;
        if (!grabbedObj.grabbedEvent.TryGetViveButtonEventData(out viveEventData)) { return; }

        switch (viveEventData.viveRole.ToRole<HandRole>())
        {
            case HandRole.RightHand:
                if (rightGrabbingSet.Add(grabbedObj.gameObject) && rightGrabbingSet.Count == 1)
                {
                    ViveInput.TriggerHapticVibrationEx(HandRole.RightHand);
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...