Building in Unity

Alright so i have a drag and drop script, a gui that makes parts, and the parts that i want to go together but i dont know how to make it so that if you drag the part close enough to a cretin spot it will snap t it and if i let go of click it will place it there because im making a game with similar building mechanics to Kerbal space program can anyone help me with that?

No idea about Kerbal or cretin spots but if you have a collider on the part you want to snap to and a collider on the part you to snap in that place you should be able to do an onMouseUp event that then sets the transform of the snapto part to = the transform of the part you want it snap to. Man that’s a mouthful!

Or, having reread your post!, when the colliders collide snap one part to the other. All you really need are two empty game objects one in each part and then set the transform of the one you want to snap in place to equal the transform of the one you want it to snap to. Just place the empty game objects in the models so when they match up they look right.

I’ve not tried this myself but the theory is sound, if you’re not sure how to do that let me know and see if I can put a script together as it’s not 100% different from attaching a sword or gun to a characters hand. I only work in C# though.

Oh and just look up colliders and attaching a weapon with the word unity in the search on YouTube and I’m pretty sure you’ll find exactly what you need.