Gear System in Vehicle Script

I know this probably isn’t very easy, but is there a way to make a gear system in a vehicle script. I have already written the script. If the vehicle wrapper already supports gears, that would be great, but I would have no idea how to use them. Anyone know how?:confused:

You’d probably give the car a property and use bricks or python to make the car do something different at each value. Like.

If ‘gear’ = 0: Cease driving controls and let gravity move the car.
if ‘gear’ = 1: The car can drive
if ‘gear’ = 2: The car can stop and not move
ect…

Like CD was saying. You can have basically set a property, and depending on the value of the property, different “power” values are added (then according to the keyboard).

So for a manual transmission, if gear = 0 represents neutral, gear = 1 represents gear 1, etc…


if (gear == 1) and (wkey.isPositive()):
power = -800
if (gear == 2) and (wkey.isPositive()):
power = -1100

Then whenever the player hits the “switch gear” button, there should be a slight lag (use a timer) where the car is in neutral.

Well, those would be the simple solutions, but a realistic one is kind of tricky.

A car gears change from strong/slow to weak/fast (1 to 5) and reverse being the same as the gear 1 but backwards (pretty slow too and the engine tends to sound different than going forward).

What does this means?, that if you are at gear one, the car should go really slow but with enought strenght to not decrease the speed on slopes, or decrease very little, making the car able to climb very angulated tracks, but on the contrary, the 5th gear should go really fast, on even ground only, and whenever the track has some angulation the car should loose speed rather fast to the degree that the car stop running (depending on the angle of the slope of course), the engine can even stop and the car must be re-started.

The right way to drive, supposing a complex race track having even ground and slopes, would be changing the gears depending on what you got in front of you. Normally this would mean to go between gear 3 and 5 normally, and using 1 or 2 only when the car stops for a reason (like a crash) or whenever a really high slope is in front, but normally gear 3 should be enought for this last thing.

Now that talk was about a normal city driver as me, not a racing one, and the city I live is in front of the sea over some hills, here automatic geared cars are quite hard to see, since they use too much gas XD.

Well after all that talk it would be nice from my side to say how to code this, but I don’t know how, sorry :stuck_out_tongue:

well its very simple to make gears that are just 1st gear, 2nd gear, 3rd gear etc…
but I’m going to make a car slowly gain speed throughout the gear, then you can shift up to go faster (like a real car) and i will make an engine sound to constantly play, but change pitch and volume depending on the gear that the car is in and RPMs
its going to take a lot of work