Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
elchtest mod :)
03-16-2010, 01:30 PM,
#63
 
Code:
void CAR::updateAction(btCollisionWorld* collisionWorld, btScalar dt)
{
    // cardynamics run then times faster then bullet
    const float num_repeats = 10;
    const float internal_dt = dt / num_repeats;
    
    // overwrite vdrift pose/velocities with bullet calculation
    UpdateDynamics();
    
    // init deltaAngularVelocity (contains sum over all delta Velocities in substeps)
    MATHVECTOR<float, 3> newAngularVelocity = dynamics.GetBody().GetAngularVelocity();
    MATHVECTOR<float, 3> oldPosition = dynamics.GetBody().GetPosition();

    //double old_force = force_feedback;
    //force_feedback = 0;

    UpdateWheelContacts();

    // apply several vdrift steps (cause frequency must be very high for a vehicle)
    for(int i = 0; i < num_repeats; ++i)
    {
        // get the new engine and so on sounds
        //UpdateSounds(internal_dt);

        //force_feedback += GetFeedback();

        // set forward the vdrift physics
        InterpolateWheelContacts();
        TickPhysics(internal_dt);
        
        // accumulate delta velocity
        newAngularVelocity = newAngularVelocity + dynamics.GetBody().GetAngularVelocity();
    }
    newAngularVelocity = dynamics.GetBody().GetAngularVelocity();//deltaAngularVelocity / (num_repeats + 1);
    //force_feedback /= num_repeats;

    MATHVECTOR<float, 3> newPosition = dynamics.GetBody().GetPosition();
    MATHVECTOR<float, 3> newVelocity = dynamics.GetBody().GetVelocity();//(newPosition - oldPosition) / dt;

    // update the Bullet angular and linear Velocities: This is the only connection from Vdrift to bullet
    UpdateChassis(newVelocity, newAngularVelocity);
}

Oh, I am interpolating wheel contacts(plane approximation) in the inner loop.
And the simulation dt depends on the framerate atm.

The original wheel forces code contains some bugs I tried to fix in my "elchtest" modification.
Reply


Messages In This Thread
elchtest mod :) - by NaN - 02-04-2010, 12:04 PM
[No subject] - by NaN - 02-04-2010, 01:01 PM
[No subject] - by NaN - 02-04-2010, 02:16 PM
[No subject] - by nomoo - 02-04-2010, 02:41 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-05-2010, 11:29 AM
[No subject] - by NaN - 02-05-2010, 11:39 AM
[No subject] - by NaN - 02-05-2010, 01:10 PM
[No subject] - by NaN - 02-05-2010, 04:15 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-06-2010, 12:25 AM
[No subject] - by NaN - 02-10-2010, 08:37 AM
[No subject] - by NaN - 02-10-2010, 11:25 AM
[No subject] - by portets - 02-10-2010, 06:58 PM
[No subject] - by NaN - 02-10-2010, 07:36 PM
[No subject] - by portets - 02-10-2010, 08:19 PM
[No subject] - by NaN - 02-20-2010, 05:47 PM
[No subject] - by CrystalH - 02-21-2010, 12:52 PM
[No subject] - by NaN - 02-21-2010, 01:45 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-22-2010, 02:01 AM
[No subject] - by sebiastisch - 02-22-2010, 10:45 AM
[No subject] - by joevenzon_phpbb2_import3 - 02-22-2010, 11:22 AM
[No subject] - by sebiastisch - 02-22-2010, 12:02 PM
[No subject] - by NaN - 02-22-2010, 12:56 PM
[No subject] - by sebiastisch - 02-22-2010, 01:00 PM
[No subject] - by NaN - 02-22-2010, 01:09 PM
[No subject] - by sebiastisch - 02-22-2010, 01:14 PM
[No subject] - by NaN - 02-23-2010, 03:38 AM
[No subject] - by joevenzon_phpbb2_import3 - 02-23-2010, 11:20 AM
[No subject] - by NaN - 02-25-2010, 03:47 PM
[No subject] - by NaN - 02-25-2010, 04:50 PM
[No subject] - by sebiastisch - 02-25-2010, 06:43 PM
[No subject] - by NaN - 02-27-2010, 03:24 PM
[No subject] - by sebiastisch - 02-28-2010, 08:24 AM
[No subject] - by joevenzon_phpbb2_import3 - 02-28-2010, 01:46 PM
[No subject] - by joevenzon_phpbb2_import3 - 02-28-2010, 01:56 PM
[No subject] - by NaN - 02-28-2010, 02:04 PM
[No subject] - by NaN - 02-28-2010, 05:57 PM
[No subject] - by sebiastisch - 02-28-2010, 07:20 PM
[No subject] - by sebiastisch - 03-03-2010, 10:10 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-03-2010, 11:39 AM
[No subject] - by sebiastisch - 03-03-2010, 12:43 PM
[No subject] - by joevenzon_phpbb2_import3 - 03-03-2010, 11:29 PM
[No subject] - by sebiastisch - 03-04-2010, 05:08 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-04-2010, 11:42 AM
[No subject] - by sebiastisch - 03-04-2010, 12:43 PM
[No subject] - by NaN - 03-05-2010, 09:17 AM
[No subject] - by NaN - 03-05-2010, 01:44 PM
[No subject] - by sebiastisch - 03-05-2010, 02:25 PM
[No subject] - by sebiastisch - 03-06-2010, 09:19 AM
[No subject] - by NaN - 03-08-2010, 11:28 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-08-2010, 11:11 PM
[No subject] - by joevenzon_phpbb2_import3 - 03-08-2010, 11:24 PM
[No subject] - by sebiastisch - 03-09-2010, 06:55 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-11-2010, 02:00 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-11-2010, 02:05 AM
[No subject] - by sebiastisch - 03-11-2010, 09:43 AM
[No subject] - by sebiastisch - 03-11-2010, 09:45 AM
[No subject] - by NaN - 03-11-2010, 03:04 PM
[No subject] - by sebiastisch - 03-15-2010, 06:50 AM
[No subject] - by NaN - 03-15-2010, 03:26 PM
[No subject] - by sebiastisch - 03-16-2010, 08:13 AM
[No subject] - by NaN - 03-16-2010, 12:50 PM
[No subject] - by sebiastisch - 03-16-2010, 01:15 PM
[No subject] - by NaN - 03-16-2010, 01:30 PM
[No subject] - by sebiastisch - 03-20-2010, 07:38 AM
[No subject] - by joevenzon_phpbb2_import3 - 03-20-2010, 12:10 PM
[No subject] - by NaN - 03-22-2010, 12:19 PM
[No subject] - by sebiastisch - 03-30-2010, 10:37 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)