Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bullet dynamics
04-18-2010, 03:07 PM,
Could you point me at the code for that or let me know if I can search svn? (didnt see anything for it yet)
04-18-2010, 03:16 PM,
The suspension code is in suspension.h. It's a bit messy atm. I am experimenting around. The idea is to have a spring-mass system someday.
    ///compute the suspension force for the given time interval and external displacement
    T Update(T dt, T ext_displacement)
        // clamp external displacement
        overtravel = ext_displacement - travel;
        if (overtravel < 0)
            overtravel = 0;
        if (ext_displacement > travel)
            ext_displacement = travel;
        else if (ext_displacement < 0)
            ext_displacement = 0;

        T new_displacement;
        const T inv_mass = 1/20.0;
        const T tire_stiffness = 250000;

        T ext_force = tire_stiffness * ext_displacement;

        // predict new displacement
        new_displacement = displacement + velocity * dt + 0.5 * force * inv_mass * dt * dt;

        // clamp new displacement
        if (new_displacement > travel)
            new_displacement = travel;
        else if (new_displacement < 0)
            new_displacement = 0;

        // calculate derivatives
        //if (new_displacement < ext_displacement)*/
            new_displacement = ext_displacement;

        velocity = (new_displacement - displacement) / dt;

        // clamp velocity (workaround for very high damping values)
        if (velocity > 10) velocity = 10;
        else if (velocity < -10) velocity = -10;

        displacement = new_displacement;
        force = GetForce(displacement, velocity);

        // account for overtravel(bump stopper) experimental
        const T bump_stiffness = 500000;
        force -= overtravel * bump_stiffness;

        return -force;

    const T GetForce(T displacement, T velocity)
        T damping = bounce;
        if (velocity < 0) damping = rebound;

        //compute damper factor based on curve
        T dampfactor = damper_factors.Interpolate(std::abs(velocity));

        //compute spring factor based on curve
        T springfactor = spring_factors.Interpolate(displacement);

        T spring_force = -displacement * spring_constant * springfactor; //when compressed, the spring force will push the car in the positive z direction
        T damp_force = -velocity * damping * dampfactor; //when compression is increasing, the damp force will push the car in the positive z direction
        T force = spring_force + damp_force;

        return force;
04-18-2010, 03:31 PM,
Quote:T spring_force = -displacement * spring_constant * springfactor; //when compressed, the spring force will push the car in the positive z direction
T damp_force = -velocity * damping * dampfactor; //when compression is increasing, the damp force will push the car in the positive z direction
T force = spring_force + damp_force;
displacement also needs to part of damp_force plus this effects displacement, that's the bit I was wondering about with the oscillations. Tyre walls also need to give otherwise the forces can be near infinite. Could be this is in there already, I'll try and catch up but on 3g so limited, could be a couple of weeks if its any help.
04-19-2010, 07:33 AM,
I got that wrong, the displacement is part of the figures in the config file. They are 'at this speed the dampers offer this much resistance', time from one calc to the next is fixed so distance and velocity can be worked out from one another. (BTW, that was to remind me, not trying to be a smartarse Smile )
Noticed you'd been looking at bump stops, the spring config was done that way to allow for rising rate springs, linkages, bump stops, etc. It should also be possible to use the spring rates to add a lower stop, like a travel strap on a live axle, using negative values.
Had a question on the rates but will stick it in another thread as I'm going off topic here.
04-19-2010, 11:59 AM,
The bump stops idea was to fight the rollover. But it didn't help. I checked the center of mass, momentum of inertia math. They look OK. It looks like there is no other way than to go through the car config files and fix the springs, dampers, mass points for each car [sigh].
04-19-2010, 12:42 PM,
I'll go through at least one of the configs, not even tried the rate plots yet. Might have to change a couple of things with the way they work:
Not sure if the time between one calculation and the next is fixed so may need to use distance as a part of the damping force calcs.
Spring rate could be way too soft, not had a look at how it's being calculated yet.
04-19-2010, 03:16 PM,
The dt is fixed. The wheel/tire calculations run with 600Hz(will change to 900Hz I think).
04-19-2010, 03:29 PM,
If the frequency can be changed then any of the velocity based suspension calculations could be screwed up, I'm reading through them now to see what's effected.
Ummm... am I missing something or has this become undrivable? I'm at vdrift revision 2671 and vdift-data 486 and the car's are bouncing of the track.
Cant see the lists for damper and spring values in the .car for any cars either, what versions should I be looking at?
04-19-2010, 03:38 PM,
Quote:car's are bouncing of the track
Bouncing? They shouldn't. A lot of the cars will roll over(due to contact patch forces). What is your framerate? The lower limit is 9fps.
Quote:lists for damper and spring values
Have a look at the

Edit: Oops, I mean
04-19-2010, 03:41 PM,
Quote:has this become undrivable
my mistake, controler config was messed up and there was some wierdness on rouen with the c7, ok for other tracks I tried.
04-19-2010, 03:46 PM,
got it, cheers.
04-19-2010, 03:53 PM,
Quote:wierdness on rouen
If the car collision box has a deep penetration with the track geometry Bullet will resolve it by applying a correction impulse which could flip the car. But this issue is very rare. I only noticed it during bullet testing/rewrite and actually only with the F1-02. It should be gone at 900Hz.

Edit: Make a screenshot if you hit it again.
04-19-2010, 04:04 PM,
Quote:Make a screenshot if you hit it again.
Ok, could be a while, going though how the .car file works again. Tried a couple of other cars and their ok, could be my C7 .car file screwed up.
04-19-2010, 04:11 PM,
What about a list with the cars to be fixed (testing on rouen)?
04-19-2010, 05:20 PM,
Quote:wierdness on rouen with the c7
OMG. I tried the c7 on rouen. Will look into this asap.

Forum Jump:

Users browsing this thread: 3 Guest(s)