XRGrabInteractable colliders do not update dynamically

I am working in a VR app that build an asset.

Parent object have an XRGrabInteractable and when inserting a child object in the parent during the game I want to add its colliders to the already existing XRGrabInteractable component .
I can add them by the following script and colliders components are effectively added to the parent XRGrabInteractable component but when trying to interact with them in VR no Grab happens.

XRGrabInteractable grabInteractableParent = parentModule.GetComponent<XRGrabInteractable>();
foreach (BoxCollider collider in boxColliders)
    // Add the new collider to the colliders array

Is it any present any sort of method like grabInteractableRefAssembly.RebuildColliders() which allow to reevaluate which are the colliders of the component? I am bypassing the problem by destroying the old XRGrabInteractable component and create a new one to include all of the child colliders.
This solution works but if the player is holding the object while the component substitution happens, of course grab functionality will be deactivate for the small moment in which substitution is happening and it is pretty annoying to have the object falling.

Does someone knows how to update the XRGrabInteractable component efficiently?

This is an interesting question, Iā€™m looking into this also. It is important for example if you have a weapon with attachments, and you snap an attachment to the weapon (at least, which changes the shape of the weapon, say attaching a bayonet to a rifle). If I test it and get it working I will post a reply here.

1 Like