Suspension/spring damping

Started by
26 comments, last by AndersO 21 years, 7 months ago
Nice little demo you got there stefu!

I got : 5156 frames in 69.04 seconds = 74.7 FPS

Running AMD 1900+ XP, GeForce3 Ti500 and 512MB PC2100 DDR
Advertisement
cool
I''ve got 99.1 FPS on P-IV-1600, GeForce4mx
which weight and spring/damping constants did you use?
Hi!!!
thanks for results.
quote:Original post by aash29
which weight and spring/damping constants did you use?

In the demo: car mass = 600kg, spring force when fully compressed = 5000N and damping factor = 3000N/(m/s). Later I''ll put these values to load from ini-file.
I use physics based on Hecker''s rigid body tutorial. Collisions are currently too bouncy because of too big CoefficientOfRestitution value.

My goal here is to create (and finish this time!) a little multiplayer rallying game. Small terrain area, short tracks, more laps, fun racing.
I think that I''m not going to have any lod terrain (too much work for one person) and use brute force instead or lower overall detail for not hw TnL like Voodoo3.
quote:Original post by stefu
I think that I''m not going to have any lod terrain (too much work for one person) and use brute force instead or lower overall detail for not hw TnL like Voodoo3.

You should implement a quadtree for the terrain if you are using a regular grid for the terrain height etc. It''s not a lot of work, and you could have it done in a day or two. and maybe a day more to get it working with your current car/land collision detection.

Your frame rate will increase, and you can expand the landscape loads and not have to worry about falling frame rates.

You really should implement it.

quote:Original post by Hybrid
You should implement a quadtree for the terrain if you are using a regular grid for the terrain height etc. It''s not a lot of work, and you could have it done in a day or two. and maybe a day more to get it working with your current car/land collision detection.

Your frame rate will increase, and you can expand the landscape loads and not have to worry about falling frame rates.

You really should implement it.

Yeah, it''s good idea. Currently I use terrain size of 256x256 tiles in in 16x16 tile groups. I use frustum culling to check if each terrain cube is visible, but not quadtree.

For terrain collisions I don''t really need any quadtree since I get the colliding tile from coordinate directly.

But quadtree could be handy for other objects (collision and view culling).
Also wanted to ask, how do you simulate spring?

That''s what I do:

_______ -----''car''
|
|
|
|
end of the spring (mass=1kg)

When I calculate force acting along the spring, I get acceleration,velocity and displacement
of the end of spring. Is it similiar to yours? Which mass of the end do you use?

Did you implement collision response?

How do you keep springs from running away from your car?
edited:
Hi!!!
I repled again, but put it now here too for anyone interested ...

>how do you simulate spring?
>
>That's what I do:
>
> _______ -----'car'
> |
> |
> |
> |
> end of the spring (mass=1kg)
>
>When I calculate force acting along the spring, I get acceleration,velocity and
>displacement
>of the end of spring. Is it similiar to yours?


Ok, I put here tyre structure I use:

struct Tyre
{
vec3 m_tyre_pos; // Tyre pos in car's local coordinates
float m_radius; // Tyre radius
vec3 m_pos, m_front, m_right, m_up; // tyre pos & orientation axes in world coordinates (computed every frame)
vec3 m_touch_pos; // tyre-ground touch pos
struct Susp { // suspension data
float m_len; // Spring length
float m_cur_len; // Current spring length
float m_force[2]; // force[0] when compressed (up), force[1] when released (down)
float m_damp_force;
float m_touch_force;
} m_susp;

};


I try to explain how I do it:

You can see I have variable Tyre.m_susp.m_len that is the length of spring.
First thing I need to get is distance from tyre base to ground.
Let that distance be float T.

Then I limit T value to range[0..Tyre.m_susp.m_len]:
if(T<0) T=0;
if(T>t.m_susp.m_len) T=t.m_susp.m_len;

Now T is the current length of spring.

Next thing to do is to calculate how big force spring does give when compressed T length.
float m_force[2]; // force[0] when compressed (up), force[1] when released (down)

float f = T / t.m_susp.m_len; // f presents T scaled to range [0..1]
float force = (1-f)*t.m_susp.m_force[0] + (f)*t.m_susp.m_force[1];

(Note that m_force[0] is currently 0. It is just there because I thought later to try using
non linear spring adding more force values m_force[3] for example.)

But now float force is the force that supports the car not falling down.

Did that answer your question how do I simulate spring?
Not wery elegant way I asked physicians, but I'm not one

Next I calculate the spring velocity (knowing how much it has changed since las frame).
And then apply damping:

force -= velocity * t.m_susp.m_damp_force;
if( force<0 ) force=0; // Force newer pulls car downwards

// Now here I apply the force to rigid body system (based on Heckers tutorial)
addForce(Configuration,t.m_pos,t.m_up*force);

// save touch force & pos
t.m_susp.m_touch_force = force;
t.m_touch_pos = t.m_pos - t.m_up * (t.m_susp.m_cur_len + t.m_radius);

>Which mass of the end do you use?

I don't really understand this question, sorry? Propably my poor english
My springs are currently weightless. I try to keep thing simple at first.

Could please you explain very shortly that mass thing? Maybe I'll learn something

>
>Did you implement collision response?

I don't have collision response in spring system. You see the red dots in my demo? They are collision check points (althought not positioned yet there). I resolve collisions later with all the collision points and apply collision response when necessary

>
>How do you keep springs from running away from your car?
>
I think this is in the code above where I just limit spring length. These lines:
if(T<0) T=0;
if(T>t.m_susp.m_len) T=t.m_susp.m_len;

I got feeling my suspension system is very simple to yours
Maybe I'm working more on it when the game starts to shape out more.

Sorry if I couldn't help, as I said, I'm not (yet) physician :D
Do you have got anything working yet?

- Stefu

[edited by - stefu on August 31, 2002 12:59:20 PM]

[edited by - stefu on August 31, 2002 1:00:56 PM]
*pop*

haha!

This topic is closed to new replies.

Advertisement