Advertisement

Suspension/spring damping

Started by August 15, 2002 06:21 AM
26 comments, last by AndersO 22 years, 5 months ago
Hello all.. I''ve made some basic rigid body thing and trying to add some simple spring system to it to simulate wheel suspensions. The spring force is calculated something like this: force=(current_wheel_position - resting_wheel_position)*constant The current_position is where the wheel is after collision is perfomed, resting_position is where the wheel "wants to be". Then this force is added to the rigid body at the suspension point. Its working fairly ok, the problem is that it seldom stops to "wobble", the suspension keeps the rigid body oscillating all the time. So I think I need to damp the spring force somehow... How do I do that?
hi,
I''m doing exactly the same...without much success, I''m afriad.
To add damping, you can use the following equation:
L - spring vector
l - length of the spring (scalar)
ks - spring constant
kd - damping constant
v1,v2 - velocities of spring''s ends
r - rest length of the spring

F = -{ks(l-r) + kd[(v1-v2)*L]/l}*L/l;
F - force acting on one verticle, -F - on another

But in my case, it''s still the same problem, it either jumps all the time or sticks to the floor

I also did collision response, maybe it wasn''t necessary.

btw, have you got demo of yur program?
Advertisement
Oh!.. Did some searching now.. found your thread. And other similar threads. Seems sort of the same problem.

I see, I need to keep track of the velocity of the wheel, in respect to the spring vector/suspension axe. The greater movement/velocity in the spring system the greater dampening?..

Sounds logical, wonder if it is.

Well, gonna try it later today, at work now. If it looks ok, I''ll put out some demo example.

I need to do the same thing soon too.
I did it once earlier but my project was destroyed due to hd crash. Now I'm back doing car physics and currently I'm working on rigid body system (using Hecker's tutorial).


quote:
Original post by AndersO The greater movement/velocity in the spring system the greater dampening?..


Basically yes, I think.

But it's very tricky. My car is jumping all the time, and get sudden impulses that makes it roll


[edited by - stefu on August 15, 2002 12:06:37 PM]
Yep, that''s basically right. You need to divide the forces that take the wheel back to it''s original position in two. To a force affecting parallel to springs direction, and forces affecting to any other direction. You always offset the position of the wheel with these two velocities. The force that is non-parallel to the spring is always applied only once and as a whole right after calculating it. The other force (parallel to spring) is stored and kept track of (and also applied on each cycle). This force could then be something that takes the wheel to normal distance from car in for example 10 cycles.. It''s also then easy to add modifiers to this force, and you would implement dampening by multiplying this force vector with some dampening factor (like 0.5f, or something) on each cycle, causing the force to diminish over time.
interesting... I use only forces acting along the spring and handle friction separately.
btw, how do you handle friction?

That''s what I do:
when I have contact with ground, I calculate friction force:

a - acceleration towards ground
tang - collision tangent, calculated like n^(n^Velocity)
mass - car mass

contact force = a * mass/(number of springs collided)
friction force = contact force*mu * tang

since there''s no use to apply it to spring''s end,
I apply force and moment directly to car


what do you do?
Advertisement
I''ve been working on a spring system for a bit (although mine is a radial spring, not a linear spring). The dampening equation I''m using is just:

Force = Force - (Force * Dampening)

What I''m not sure exactly how things work in the physical world (which I will need to work out if I''m going to get my simulation going too. ack), but you could also try squaring the force:

Force = Force - (Force^2 * Dampening)

This will mean that a larger force will be dampened more than a smaller force. Which will probably help a spring settle down a bit.

There is an article at Gamasutra (Exploring Spring Models) which might help.


Trying is the first step towards failure.
Trying is the first step towards failure.
quote:
Original post by aash29
interesting... I use only forces acting along the spring and handle friction separately.
btw, how do you handle friction?

That''s what I do:
when I have contact with ground, I calculate friction force:

a - acceleration towards ground
tang - collision tangent, calculated like n^(n^Velocity)
mass - car mass

contact force = a * mass/(number of springs collided)
friction force = contact force*mu * tang

since there''s no use to apply it to spring''s end,
I apply force and moment directly to car


what do you do?


I divide velocity again to two parts. One that''s parallel to the normal of the ground, and other that''s parallel to the ground. I then multiply the vector that''s parallel to ground by a friction value (that can vary depending of the ground material), leaving the result as a new velocity.

Friction value range is of course 0 - 1.
So you''ve got friction depending on velocity? I always thought it depends on acceleration, does it work well?
quote:
Original post by aash29
So you''ve got friction depending on velocity? I always thought it depends on acceleration, does it work well?


Yeah. If you make it depend of acceleration, then the object doesn''t receive any friction when going at constant speed.

This topic is closed to new replies.

Advertisement