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.