# Square wheels

I know how to use wheelcollider, but how would one go about creating a car with square wheels instead of round? The wheels would need to be capable of different grip settings, and also work with other shapes like triangle and round.

It depends on what you want to do. If you want the car to drive on it’s own, then I would recommend using an animation, that way you could edit how the wheels move. If you want the player to move it, I would recommend playing with colliders. I haven’t done anything like this so I’m sorry if I’m not specific. Hope this helps.

The wagon would move up and down as the square wheels turn, so you can just determine the wagon’s y offset from the transform.rotation.eulerangles of one of the wheels (assuming that they all turn the same). I would keep a root object on ground level and make the wagon a child of it, so it can move up and down without changing the actual position of the object.

In essence, you would rotate the wheels by code depending on speed, and don’t give them any actual colliders with rigidbodies that react with the ground. The forward and backward movement of the wagon would still be accomplished by rigidbody and velocity setting, but it just needs a normal box colider with flat bottom that sits on the ground.

This could be achieved with a hinge joint (in 3D physics anyway). Simply place the hinge at the center of the wheel with the anchor facing into the vehicle. Use add torque to make them turn. If you really wanted you could attach these to an axel and add suspension with spring joints.

To be realistic your square wheeled vehicle won’t be moving very fast. You probably don’t need all of the fancy high velocity stuff a wheel collider provides.

This is an idea not the implementation. Heres example
You could raycast from bounding box vertices to the ground collider. Get the closest point and get its difference and match the box wheel to the ground. Then make it rotate so that it spins on the ground? I haven`t tested this so hard to say the best solution. : ) I hope it helps.