# car simulation - gearbox implementation

hello guys,
i searched for a long time for a solution for my problem:

i made a vehicle simulation in blender. now i want to add a transmission (which means gears) to my car that works lika a real gearbox.
So at least i want to be able to change the gears and the force, which accelerates my car, is depending on the current gear.
The best would be if i could simulate a turque curve, but i think this isnt possible with ipos cause they only work with animation.

Im sorry for my english, im german =)

i upped the program, simply extract it with the dlls and have fun.

THANKS

So all you need to do is to control the forces that move your car. You would need a python script/module for that.

so you need to write a function like this:

``````def calculateForce(currentVelocity, gas, gear):
# whatever you want
# e.g.
newForce = gas * currentVelocity * gear * 0.01 * (pi*2+something) / sqrt(doesnt+matter)
return newForce

``````

Than you apply this force to the car. You have to findout the right formula by yourself.

I hope it helps

thats awesome thanks. =)

now my force is dependent on the revs per minute, the power and the gear.

but i dont manage to get the force dependent on the speed my car is driving. in real life, every gear comes to an end, because the engine can’t raise the revs anymore. in my game, the force then stays on a value and continuously speeds up my car.

the code:

``````if (chassis.u_min_plus &lt; 1):
if (chassis.u_min_plus == 0):
chassis.force = 0
else:
chassis.force = chassis.drehmoment * chassis.gear * -1
else:
chassis.force = (chassis.drehmoment * chassis.gear * -1)
``````

chassis.u_min_plus: the value the current engine rpm get raised if gas is pulled.
drehmoment: the precalculated torque

maybe the solution is simple. i sat around and tried this s*** for so long now, im dizzy =)

greetings

Isn’t this threaddealing with a similar problem?

beside that you might establish some damping at the car (rigid body settings)