Start your engines!

20150509_235700_progress

Not quite started, but tonight work began on Zoom Car World 3, the demo and learning project I will be using as a stepping stone to write a full blown racing simulator.  For years this project has been placed on the sidelines, but with the current goal to work towards it for an hour a day every day, I am confident things will keep moving.

Current progress was getting back into the old ZCW3 project that was started last summer just before Sonia and I went off to Peru to hike the Salkantay-Inca trail.  The project has some form of very basic track editor in the works, although ultimately a lot more work is still needed.  Currently the efforts are being focused on giving the car an engine that is simulated, at least on a basic level, physically.

This means taking several things in consideration, the inertia of the engine.  All those rotating parts resist changes to the rotation.  If they are not yet rotating, they will fight to remain stationary, and if they are rotating they will fight the urge to slow or speed up.  A torque will be applied to the engine to increase, or decrease if needed, the speed of these rotations.  However I must have some units wrong or have yet to combine all the parts in the code correctly.

angularAcceleration = outputTorque / engineInertia;
angularVelocity = angularVelocity + angularAcceleration * deltaTime;
engineSpeedRPM = angularVelocity / tbMath::kTwoPi * 60.0f;

That is essentially what I believe I need to do.  angularVelocity should be in radians a second from everything I understand, and outputTorque and engineInertia in Newton-meters (Nm).  This would make engineSpeedRPM, in revolutions-per-minute to be 60 times angularVelocity over a full rotation (two-pi).  This does make sense to my brain, however the results, rate at which the engine speed increases / decreases is not quite what I was expected with no clutch or drive train.  It takes a good 3 seconds to go from 1000rpm to 8000rpm and I would be expecting this to be like a second.  Will continue tweaking, so stay tuned for updates.

Comments are closed.