No-python car suspension

hey,

is there a common way to realize a - mor or less - realistic car suspension? i googled around and found a lot of python scripts … but some people are doing it without a script. so, it seams to be possible. but how? i couldnt found any working example or explanation. Can anybody tell me how its done?

can nobody point me in the right diraction?

can nobody point me in the right diraction?

SuperGloop. Made one, I don’t think this is a tutorial though.

The video doesn’t really look like suspension to me, just a wheel rig. Isn’ suspension the system that handles the way a car bounces up and down? But anyways, it might be doable with a rig, if you’re good at setting up bone restraints maybe you can figure it out.

You can do simple vehicles with rigid body contraints.

It is doable, and fairly easy. A very simple rig with suspension is presented in this tutorial:

http://blender.freemovies.co.uk/car-game-tutorials/

A much better python-driven vehicle that takes advantage of Blender’s built-in vehicle controller physics is offered as a link within the Blender docs themselves. Here it is:

Even though it uses a python script to control the vehicle, it’s very easy to understand and will give you much more functionality.

Suspension is achieved by setting up a generic spring constraint on each wheel, and adjusting the limits and spring values in the Rigid Body Constraint panel of the Physics Properties window.

/uploads/default/original/4X/6/5/a/65ae63942dee22ff7f53a9fafe6c25f15df1f655.jpgstc=1

A car spring will normally be set up on the Z axis while all other axes are disabled. The Limits values refer to how much slack is given in either direction on that axis, so the lower limit you provide for the z axis will tell Blender how much distance from a wheel’s normal position it can move downward when colliding with something. The upper limit determines how much it can move upwards. A lower limit of -1 and an upper limit of +1 would give the spring 2 units of movement. A 0 value will keep it rigid in that direction (upper or lower).

The Spring values determine how easily the spring will move. You will only need to use the z axis for your springs, so leave the others disabled.

Attachments


Woah. Where the heck did you find a ‘generic spring’ type of constraint? Are you running a custom build, a build-bot build, UPBGE or what? Official 2.77a doesn’t have that

I’m running 2.76b

It’s not available in the BGE.

You can use 6-dofs. However, setting up springiness in the editor is not aviable yet. You propably want to use scripting anyways.
Remember about Hooke’s law
For amortization you want to add the damping over the stiff spring. It’s achieved using damping.
The final formula is:

Fsuspension = k * x + c * vx

where:
k = stiffness (N/m)
c = damping rate (N/m/s)
x = compression (m)
vx = compression speed (m/s)

I hope that this helps;)

By the way - that constraint shown above has normalized damping. If you want to use normalized damping inputs, you calculate the actual damping rate by multiplying k by the normalized damping rate.

I swear that half of you guys are only trying to show off and not very concerned about helping someone who’s new to Blender.

I use the create 6dof script linear and angular scrips supplied by tutorials for blender website…

one sec let me dig up a link

Linear
http://bgepython.tutorialsforblender3d.com/PhysicsConstraints/6DOF/LinearSpring/createConstraint

angular
http://bgepython.tutorialsforblender3d.com/PhysicsConstraints/6DOF/AngularSpring/setParam

I will try to set up a demo of several suspension types:
-live/dead axle
-double wishbone
-something else if I find enaugh time
Using only basic python. You may use it as a resource to learn from.
However, I’m not sure how to make the wheels steer when using constraints.

Well that makes is not so useful for a question about the BGE doesn’t it.

In the BGE you can use:


Which does much the same, but doesn’t allow control of spring or damping.

Attachments


Thank you sdfgeoff. whats the diffents between your 2 screenshots? could you do a example blendfile?

both of these websites contain sample blends

one is a angular spring, the other is an linear spring.

Here is a video that might help,


I tried this and it worked well.
The suspension was done using logic bricks. He put a force on the vehicle body pushing up and a force on the suspension components pushing down. The wheels, suspension components, steering components, and body are all tied together using Generic 6 Dof constraints. The video’s info contains a link the the blend. file; you can download it, and see for yourself how he did it. It’s not perfect, but it’s passable.
1 Like

Hello, I have car model from carbody and wheels , and rigid body collision cause a lot of problems.
My car start bouncing when I pres P car disappear or jumping like spring. I want use on wheels rigid body with cylinder collision box and connect to motion actuator Linear Velocity to make inertia. But when I assign to carbody rigid body physics according that video above and to wheels also rigid body. And result was: car body jumps and the wheels fell from car. So until now i create box and parent it to carbody with wheels and set motion actuators to that box. So my car is now able to move without any problem forward and backwards left , right , but problem is : Turn is unnatural too quick and it cause slide. The Wheels not react on torque force. soo no inertia on them. So when I press W they start turn and when I release that key they stop… not good.
projekt_trabant_blender_old.7z (3.5 MB) So here is my file. its in Blender 2.79 Game Engine
Can you help me please? Thank you
Its classical controls. WSAD H- horn Space is Brake lights.
I try that without any python.

Hello there!
In order to solve the problem using your approach to vehicle physics, I’ll have to do some more experimenting. I tried to do vehicle physics many times before, and never could do it using the approach that you tried. This doesn’t mean there isn’t a good way to use that method, it just means I don’t know how!
I’ll be looking into it, but meanwhile, I’ve taken your project and re-did the vehicle physics taking the route that I would recommend. Your should find everything other than the vehicle physics the same. Since I used a completely different method, I won’t take time to explain all of the differences. I’ll just let you see for yourself, and if you have any questions please ask!
I did change the controls a bit. I enabled gradual steering using the mouse. The front car wheels are tracked to the mouse’s left-right movement. I noticed that your first person camera was also tracked to the mouse, so I added a logic brick to the camera and steering components such that if you click the left mouse button, then the first-person-camera will be tracked to the mouse; otherwise, the mouse will control steering. If you would rather revert back to “a” and “d” I have all of the logic bricks necessary to do so, but they are deselected (so they aren’t currently working). Just select the steering components (found inside the front tires), deselect the tracking actuator, and select the two motion actuators. You’ll have to do this for both steering components.
There is one bug in the steering component tracking the steering target. If the vehicle flips, the bug will show itself (and will be quite obvious); however, I’ve worked with it, and I haven’t been able to flip the car, so it should be fine. Reverting back to “a” and “d” will fix this problem should it occur.
To adjust vehicle speed, adjust the torque value on the wheels.
To adjust spring tension, adjust the force being applied to the four suspension components found at each wheel and/or the upward force being applied to the box surrounding the vehicle.
To adjust turning radius of front wheels, adjust the min/max value of the mouse.look actuator on the “steering target mover” (the smaller cube in front the front wheels).
Everything object should be named, so hopefully you wont have any problems finding anything.
Here it is:
https://drive.google.com/file/d/1Vj2h9lgv1BoQ8NTnmaowPWxB4Dgeas3Y/view?usp=sharing
I’m sorry that I was not able to help with the original method, and hopefully I can find a way to make the original way work (I’m actually interested in finding the answer myself!)
I hope that this helps, and if you have any questions or anything else, just let me know!!

1 Like