Wednesday, September 19, 2007

Driveing Game

I have been working on the drveing thing but i have ran in to a problem the gearbox..
I am not the best at math so i don't know how it is supos to be..

3 comments:

Ruth said...

Really, what's the problem? If it's not too advanced I could probably help you with it....:D

Go+ said...

Here is my problem:

This is my gear ratios
Gears(0) = -3.5 'R
Gears(1) = 0 'N
Gears(2) = 3.5 '1
Gears(3) = 2.2 '2
Gears(4) = 1.5 '3
Gears(5) = 1.1 '4
Gears(6) = 0.94 '5
Gears(7) = 0.89 '6

DifferentialRatio = 3.6

TransmissionEfficiency = 0.7


Then this is how i get the engine RPM:
RPM = Wheel.GetAngularVelocity * Gears(Gear + 1) * DifferentialRatio * 60 / System.Math.PI

Then this is what i use for addiong speed to the wheel.

Dim EngineTorque As Single = TorqueCurve() 'Get the relavant RPM;
Dim TorqueTemp As Single = EngineTorque * ThrottleAmount
RPM_Out = TorqueTemp * Gears(Gear + 1) * DifferentialRatio * TransmissionEfficiency
Wheel.SetTorque(RPM_Out, 100)

This is what is in TorqueCurve()
If RPM < 5000 Then
Return 390
ElseIf (RPM < 6000) Then
Return Convert.ToInt32(390 * (1000 - (RPM - 5000)) * 0.001)
Else
Return 0
End If

Some of it might be confusing because it is vb code :)

Ruth said...

*cough* I only said I'd TRY, ok? uh...that's like.....idk... BLECK!!!!