Hand tracking collission does not work

Hey, I’m new to ML programming and I have the following problem:

I have a cube (Box Collider [isTrigger=true], Rigidbody [isKinematic=true]) and XR hands (left and right). I added a Box Collider [isTrigger=false] to the hands, but the OnTriggerEnter method doesn’t get called.

The method is inside the Loc Handling (Script), and the cube is created on menu press and does not exist at program start.

private void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("RHand") || other.CompareTag("LHand"))
    {
        p = gameObject;
        if (p != null)
        {
            //dosmth
        }
    }
}



Unity Editor version: 6000.0.44f1
ML2 OS version: 1.12.0
XR Hands version: 1.5.1
Host OS: Windows

Hey @rayz0_0,

This is more of a general Unity question and not really Magic Leap related so you might want to seek more information in another space.

While you’re here though, I can give you some things to look into!

Overall, this seems more like a Unity collision issue.
Please take a look at Unity’s documentation on how different objects and collision settings send messages and when they do not

On that page, you’ll find a table that will tell if a kinematic, static, or dynamic object collider will receive OnCollision or OnTrigger events. Use this to help figure out if your objects should be sending/receiving events.

This part of the page might be of the most interest to you:

Trigger messages occur in the following circumstances:

  • A dynamic or kinematic trigger collider collides with any collider type.
  • A static trigger collider collides with any dynamic or Kinematic collider.

Also, you can try setting your Rigidbody component Collision Detection to Continuous instead of Discrete. That might change the behavior you are experiencing.

And finally, the last thing I would try is having a Rigidbody component on both game objects

Good luck with your project!
Let us know if there’s anything else we can help with that is Magic Leap specific.

Best,
Corey

Additionally to your suggestions, I found out that the R/L_Wrist component needs a Collider and Rigidbody, and now it works.

Thanks for the help! :slight_smile: