Original Post
Hello everyone !
I have problem with my car simulation when i shift up gears.
I am loosing engine rpm and speed.
I work with the Marco Monster Car Physics Tutorial as reference.
In fact, i understand why i loose rpm, it is pretty logic, but i can't figure how to fix it.
Here is the demo i have done so far.
demo 1.0
Arrows Forward and Back = Acceleration, Brake.
Arrows Up Down = Shift gears.
If i shit up gear, i will have less power right ?
So, if i have less Fdrive and a Air Drag that grew up with the speed, how can my rpm go up ?
This is my problem actually...
Everything looks normal, the faxt that rpm go down when i shift up gear looks ok, but then, i need to get more rpm in order to see the difference of speed.
By the way, the problem may come from here :
This is how i calculate the km/h of the car.
In the first part of the tutorial, i move my car with the posX update.
on my simulation, my car have a 42.5 pixel of radius wheel.
Inside my Engine Class
I don't know how to get the the angular velocity properly, so i used the tricky way of the km/h technique in order to get the rpm...
Any help would be greatly appreciated !
Thank you for reading !
// fixed title - missing f in shift
[Edited by - LessBread on July 29, 2010 12:04:47 PM]
I have problem with my car simulation when i shift up gears.
I am loosing engine rpm and speed.
I work with the Marco Monster Car Physics Tutorial as reference.
In fact, i understand why i loose rpm, it is pretty logic, but i can't figure how to fix it.
Here is the demo i have done so far.
demo 1.0
Arrows Forward and Back = Acceleration, Brake.
Arrows Up Down = Shift gears.
If i shit up gear, i will have less power right ?
So, if i have less Fdrive and a Air Drag that grew up with the speed, how can my rpm go up ?
This is my problem actually...
Everything looks normal, the faxt that rpm go down when i shift up gear looks ok, but then, i need to get more rpm in order to see the difference of speed.
By the way, the problem may come from here :
This is how i calculate the km/h of the car.
In the first part of the tutorial, i move my car with the posX update.
on my simulation, my car have a 42.5 pixel of radius wheel.
simWheelLength = (42.5 * 2 * PI);degreesOfRotationPerFrame = (engine.velocity / simWheelLength) * 360;degreesOfRotationPerSecond = degreesOfRotationPerFrame * 30; rps = degreesOfRotationPerSecond / 360;//this is how i get my km/h (0.34 meters is my car wheel value)kmh = ((rps * 0.34) * 3600) / 1000; var t = kmh * 1000 / 3600;//then i pass the rpm of the wheelengine.rpmWheel = t / 0.34;Inside my Engine Class
//=========================================================================// GET RPM ENGINE //=========================================================================public function getRpmEngine():Number { rpmEngine = ((rpmWheel * gearRatios[currentGear] * differentialRatio) * 60) / (2 * PI); return rpmEngine;}//This is how i get my FdrivemaxTorque = getTorqueCurve( getRpmEngine() );Tdrive = maxTorque * gearRatios[currentGear] * differentialRatio;Fdrive = Tdrive / 0.34;I don't know how to get the the angular velocity properly, so i used the tricky way of the km/h technique in order to get the rpm...
Any help would be greatly appreciated !
Thank you for reading !
// fixed title - missing f in shift
[Edited by - LessBread on July 29, 2010 12:04:47 PM]