So, I’ll start this off by prefacing that I’m not new to unity i have experience with code. But for the life of me i can’t figure out how to make a system where to objects attach together and bolt in place. There is game that replicates exactly what i want to do.
The video below shows a cylinder head attaching to an engine block and then the player scrolls the mouse wheel on top of the bolt to screw it in until it won’t anymore. When all bolts are tightened the cylinder head is fully attached. This is where I’m lost, I have used colliders and made a bolt spin until it hits another collider and stops.
But it is definitely a terrible way to do that, especially when the entire object might require 30 - 50 of these bolts meaning 2 colliders per bolt. Any help on this would be much appreciated.
Sounds like you are assuming that you need to go through the physics engine (colliders, forces, etc.). I suspect you’d be better off hand-coding the specific interactions you want, rather than trying to create a physical model that can reproduce them.
For instance, instead of rotating until you hit something, just rotate a certain number of times that you “know” is how many rotations it takes to screw that thing in. A screw that is currently in its socket probably shouldn’t have a collider at all (though it might need one if you instead drop that screw loose onto the floor).
I’m pretty sure they just authored custom movements for each type of thing. They probably made a few parameter-driven behaviors like “screws in” or “plugs in” or whatever, then gave each of those things anchor alignments for their axis and position on the objects, then when your inputs get close enough, they latch into the sequence to tighten or loosen.