Gear ratios connected to Acceleration

I am very new to the Blender game engine (though I have played around with modeling for quite awhile) and want to start on a racing car. My question is a two part one…

First, can gear ratios connected to acceleration be made using just the nodes? If so, how?

Second, If not possible, how should I start on the coding?

Thanks to anyone who takes the time to answer!

This depends how you move the car.

Then you directly apply positional changes (Location change) you basically provide the size of an atomic step. This size determines the speed of the car. When you stop calculating and applying positional changes, the car will stop.

When you use the build in physics engine you have wo options.

  • You can provide a velocity. The physics engine will calculate steps (size and direction) from the explicitly set velocity and other parameters (gravity, friction, damping …). This means you get the location changes over a longer duration.

  • You can provide one or more forces. The physics engine will combine them and calculate a velocity from it. This will result in a positional change (see above).

All this methods result in a positional change.

Gears appear to influence the forces from the engine to the tires. This depends on the current momentum of the engine and the tires. The game engine does not o that as it directly applies the forces to the tires (or the car body). You can simulate the “gear effect” by calculating the forces after the gear. You can derive the engine rotation speed from tire rotation speed considering the current gear due to the fixed connection via gears.

A real engine does not provide a linear or constant force. It depends on the rotation of the engine (and the momentum of the masses). You can reduce the dependency on to the current speed of the vehicle. (A game is for entertainment rather than precise simulation).

For example:
When the car is driving 2 BU/s in second gear the force from engine is 5BU/s² (BU=Blender Units). When driving in third gear the force is 2BU/s² (weaker).

When the car is driving with 10 BU/s in second gear the force is 2BU/s². When driving in third gear the force is 6 BU/s² (stronger).

As you need to consider the current speed you will need python to simulate gears.

If you want to get started coding, I recommend using a Python brick in “module” mode, create a script in the text editor named “” (or anything as long as there is .py at the end), and write this:

import bge

def init(controller):
    owner = bge.types.KX_VehicleWrapper(controller.owner)
    # your initialisation code here (run once)

def update(controller):
    owner = controller.owner
    # your gear code here (each frame)

The idea is to have an “always” brick triggering a Python module controller ONCE: “program.init”
And a second “always” brick in pulse mode triggering a second Python module controller: “program.update”

I recommend you to play around with the code, because if you are not used to programming, there will be some things to catch on the way :slight_smile:

Documentation for the VehicleWrapper:
Documentation for the BGE API:
Documentation for the UPBGE API:

Okay, I think I understand. Thanks!

Okay, this is great! Thanks for the help!