# 2D Joint/Wheel Question

Hi, Im currently working on a 2D game and i need to snap wheels on an object, i tried using various kinds of joints, yet they never seem to stick in place and keep moving a certain distance from the main object. Basically something like a skateboard and 2 wheels.

Is there something else other than joints im supposed to be using rather than joints?

sorry for the noob question

thnx for ur time Unity Community

Btw i intend to use torque on the wheels for motion, if thats not a great idea and/or should just stick to apply force, your guidance would be appreciated

Just to begin with:

When you attach one object to another.

For example, you have a spaceship and you want to attach a wing. Or you have a truck and you want to attach a container on the back. Or you have a player character and you want to attach a backpack.

Simply - you need to use the parent-child relationship

Note that the parent goes with the â€śtransformâ€ť.

So in short, you would do something like this:

One â€“ make a new â€śwheel unitâ€ť. Use â€śInstantiateâ€ť to do this. if you do not know about Instantiate read the doco, or ask a new question, or search.

``````var newWheelUnity:GameObject;
newWheelUnit = Instantiate( myModelWheenUnit );
``````

You now have a beautiful new wheel unit.

So. Now you must make it that your VEHICLE is the PARENT of that new wheel unit. Donâ€™t forget, you have to use â€śtransformâ€ť for this.

So first set all the other stuff for newWheelUnit â€¦

``````newWheelUnit.name = "special name";
newWheelUnit.layer = 13;
etc etc
``````

Now set the parent â€¦

``````newWheelUnity.transform.parent = yourCar.transform;
``````

Now you have to set the position of that child. USe localPosition to do that.

``````newWheelUnity.transform.localPosition = Vector3(0,0,0);
``````

it wonâ€™t actually be â€ś0,0,0â€ť 0 it will be the actual position of the wheel on the car. Since it works in meters, it might be something like â€ś1.25, -0.835, 0â€ť

First you have to master all this so that you can easily â€śadd partsâ€ť to something else

Once you get really good at this, you have to look in to the whole topic of making wheels turn, etc. That is a hugely separate topic and you will need to do a lot of searching and questioning. Good luck!