Joining objects

Hi,

I’m new to unity and the forum, so please go easy on me :slight_smile:
I’m not sure what this is called so I don’t know what to search for…

Say you have three cubes;

One of those cubes is bigger than the rest. This is the main cube.
The other two cubes can vary in size (doesn’t matter). However now I want to join one of the cubes to the bottom of the main cube and one of them to side (this could be a variable, they both could be put on the bottom if I wanted). I would like to be able to do this via a nice gui button, but that’s not important at this moment in time.

Now if I move the cube the other two cubes will be joined to the main cube, but if I clicked on the gui, I could unjoin one of the cubes at will.

Sorry if I made this sound a lot harder than it is, but I really don’t think a search engine would help me on the basis of the criteria here :slight_smile:

Thanks

Sounds like you need to make a very simple script that modifies Transform.parent and Transform.localPosition for the two smaller cubes. As long as they don’t have Rigidbodies attached, the children of a transform will follow its movements.

Hi,

Ok, thanks for that. I’ll see what I end up with :slight_smile:

Hi,

I couldn’t get the transform to work and link the two together. I have been reading the documentation and think the HingeJoint seems more like I was trying to explain.

Could someone give me a little step by step on how to connect one cube to another. One of the cubes is a player (I can move it left and right and shoot) from what I have done from the tutorials.

I would be very grateful.

Thanks

argh… done it… always the way! loves drag and drop :slight_smile: