Hi,
i am new in XRI Toolkit development.
My problem is, that i can’t find a way to hover / select only the touched part of a complex 3d-model (consisting of a hierarchy of objects).
Every time i hovers / selects the hole object (root node of object). Every node has a
XRGrabInteractable component, a mesh, a collider and a rigidbody.
Please help!
Hey @DevTom81 ,
The easiest way to address this is to make sure you manually define your Collider list in the parent and child nodes. By default, the XR Grab Interactable will search all child objects and auto-populate the collider list for any colliders it has found, even if they share a Game Object with another XR Grab Interactable (something we will probably add support for in the future). You will also want to check any child nodes that have their own children to ensure you aren’t accidentally picking up colliders in an unwanted way. I have added some screenshots of the setup.
One final note. If you are applying rigid body physics, you’ll want to make sure the child objects are set to Is Kinematic or they will fly all over the place. Also, maintaining a scale of (1, 1, 1) will product spatial correct results if you move child objects around and then manipulate the parent. In my example, setting it to 0.5 causing some positional orbiting and shearing that would be unwanted in a shipping project.
Hi @VRDave_Unity , thank you for your answer!
Is there anything else to do? Does it work without unregistering from XRInteractionManager?
Hey @DevTom81 ,
None of the child objects should be unregistered from the Interaction Manager, they just need their collider list manually. I guess I’m still a bit confused as to the full use case though. Are you trying to individually manipulate the child objects? And if so and you pull it away from the parent, do you want it to remain a separate entity or still be a part of the parent node?
Hi @VRDave_Unity ,
thank you for your answer!
None of the child objects should be unregistered from the Interaction Manager, they just need their collider list manually.
If I just manipulate each node’s collider lists (each node only contains its own collider), it doesn’t work. But if I unregister the interactables from XRInteractionManager, change the list of colliders and register again, it works and I can “grab” each individual node without moving the root object.
var interactionManager = interactable.interactionManager;
var objectCollider = interactable.gameObject.GetComponent<Collider>();
InteractionManager.UnregisterInteractable(interactable);
interactable.colliders.RemoveAll(x => x != currentCollider);
interactionManager.RegisterInteractable(interactable);
But I’m afraid that’s not the right way. Is there a way to do it without unregistration/ registration?
I guess I’m still a bit confused as to the full use case though. Are you trying to individually manipulate the child objects? And if so and you pull it away from the parent, do you want it to remain a separate entity or still be a part of the parent node?
Yes, my goal is to decompose complex objects.