Grab from collider surface instead of center

I have a non-convex object (it’s a skull-base) that the player is able to grab using XRit Grab Interactable. The object has a sphere collider as seen in the image. But I can’t figure out how to grab the object from where the laser hits the surface of the collider and it always grabs the object from the center of the collider which isn’t ideal because it’s very large and it almost slaps user in the face when grabbed. Should mention that I need to use dynamic attach and matching position and rotation. I’ve set the distance calculation mode to collider volume. But that doesn’t help for some reason. I read that it order for that to work, the mesh needs to be convex. Even though my mesh is not, the collider is. So is there a way to make the grab work from the outer parts instead of the center?


I noticed your list of colliders has 1 element, but that element is set to null.
My advice would be to delete that element from your array, or assign the reference of the collider to that entry.

There is code in the base interactable that checks if that list is empty before populating the list of colliders. When doing collider based math, that logic needs to be done correctly to work.

  // If no colliders were set, populate with children colliders
            if (m_Colliders.Count == 0)
            {
                GetComponentsInChildren(m_Colliders);
                // Skip any that are trigger colliders since these are usually associated with snap volumes.
                // If a user wants to use a trigger collider, they must serialize the reference manually.
                m_Colliders.RemoveAll(col => col.isTrigger);
            }
1 Like

Fair enough. Thank you for pointing that out. I had a reference to the collider on the object to see if it acts differently. But I removed it before the screenshot.

1 Like

Now to be fair, that was not the issue. The player still grabs the item from the center instead of the collider volume.