#Brick snapping logic in VR using XR interactable toolkit

1 messages · Page 1 of 1 (latest)

final ginkgo
#

Hello everyone,
I am currently building an experimental room using Unity. Any help would be appreciated, or even compensated!
🔵 Context:
In the room there will be some 'LEGO' like bricks on a table, and people will be asked to build a model. I am currently working on the CODE for the snapping mechanism, but I am having problems since I am using the XR toolkit for grabbing.
Ideally, the bricks should have the same behavior as in real life (that is, any top stud should be able to connect to any bottom snapping point).
I used empty game objects in the positions where I want the snap to happen. Currently, I have been able to make the bricks snap in the correct place, but I have some questions:
🤔 Questions

  1. What is a good way to make bricks move together after snapping? I tried making them parent of each other, but kinematics/gravity are then only possible for the parent object, and I can't grab the other object. The best solution so far is using 'joints', but this makes the bricks not fixed but rather 'flexible'.
  2. After snapping, I should be able to break the snap once 'isGrabbed' is true on both bricks, and I pull them apart. How can I implement this?
fervent gorge
#

Maybe voxels?

#

You'd be basically making minecraft, lol

#

just with uneven blocks

quartz gust
#

You most dont need anything like that for connecting objects.

quartz gust
#

We dont see any of your setup, so you should show more if you want specifics. My assumption is that you are trying to move by the transform while also using rigidbodies. If you need to specifically grab one object and not use physics, making the one piece kinematic while the rest are not kinematic might still work fine.