- Home /
How to create car suspension system?
I am currently trying to create a car suspension system. It should contain the following:
-The suspension, wich should be movable in only 1 axis, and should not rotate in any way.
joint that allows no movement, but allows free rotation in 1 axis.(back wheel)
joint that allows no movement, allows free rotation in 1 axis, and allow restricted rotation in another axis.(front wheel)
Both the joints should be turned by rigidbody.addTorque().
What i have come up with so far is to make the suspension out of a "Configurable joint" with all rotation locked, and 2 of the movement axis locked. The "back wheel" joint is a "hinge joint" that has its axis set to Z and anchor at (0,0,0). This system kinda works for the back wheels, except they still seems to be moving a little in the wrong axis. However, because of the restrictiveness of the hinge joint, i'm not allowed to rotate the front wheels in the Y axis through scripting. Even if i say "transform.rotation.eulerAngles.y = 15", the hinge joint forces it back to 0 the next frame, and adds force. So basicly, when i rotate the wheels, the whole car starts bounching around.
So, do any1 have a better system for this? I know i wont get good "driving physics" using physical rotation of the wheels to move the car, but the car will never go much faster than 10-20 km/h anyways, and are supposed to be more like a bulldozer than a car, and from what i have seen so far this way of doing things is gonna work just fine for me.
Have anyone here made a system like this before? If so, please share it :)