How do you snap objects together at runtime in vr?

I want to create something like a assembly instruction in VR with lots of pieces lying around that can be interacted with vr controller. When two matching pieces are close to each other, I’d want them to snap together.

I don’t know where to start to make two mesh snap together in VR with the base VR template.
I tried adding socket to the pickup cube and attachToComponent, but it seem to conflict with the existing physic of picking things up in VR.

It sounds like sockets would be the way to go, like you tried! Could you clarify what you mean by “it seem to conflict with the existing physic of picking things up in VR.”? Perhaps you are forgetting to turn physics simulation back on when you place the object down?

I meant that the pickupCube when picked is already using the node attachToComponent to attach to the VR hands. So as long as I’m holding it, it doesn’t attach to something else.

Ahh I see, in that case you should be able to manually trigger the “Release Actor” event on the BP_MotionController for whichever hand is currently holding the object. You would need to do this right before your logic for attaching the held block to the other pieces.

That being said, you should be able to attach multiple components together, perhaps if you can’t attach the held block to multiple different objects (ie the hand controller and the other block pieces), then you can rearrange this ‘hierarchy’ so that you attach the other block pieces to the held block (instead of the other way around), and the held block attached to the hand.

Thank you for your insight! That’s great advice.