Slow vehicle's acceleration speed

Good morning,

I opened this thread because I need some help (maybe the appropriate term is "suggestion") on a system that I am actually making.
To make driving more realistic, I am making a transmission system.
It is working pretty good, but I found out a big problem: the acceleration speed of some vehicles is too much big.
While I am driving an Infernus, for example, it takes less than 1 second to exceed 40 km/h.
So, I would like to slow some vehicles's acceleration speed, to make that transmission system more realistic, and easier to control.
My problem is that I actually have no idea how to do this.
I am just planning on playing with speed cap, but it could take a lot of performances.
Do you have any idea ?

Thank you for reading my post, and sorry for my bad english.

With respect,


Try this

You didn't understand. I want a suggestion how I could make the acceleration speed of some vehicles slower.

There is no way...

There can't be no way.

I think there's a way using SetVehicleVelocity and GetPlayerVelocity.

Divide per two all the values gotten through GetVehicleVelocity, set the new divided values with SetVehicleVelocity and logically the vehicle will slow down per two.

I think it wont works because while driving, the vehicle speed is constantly updating. If I place it in OnPlayerUpdate, it wont be really synchronized because the vehicle speed will increase faster than my use of these functions will. This will cause confusions: the game will crash.

Anyway, thank you for trying help me.

Why would you like to use "OnPlayerUpdate" ?

This callback is called so many times within a second. Use a per-vehicle timer which is launched in "OnPlayerEnterVehicle" and which is destroyed in "OnPlayerExitVehicle".

Anyway, I think my way is the only one possible, because I don't see of any other.

If I'm using my own timer I would have biggest problems than with OnPlayerUpdate. The OnPlayerUpdate is going at the right speed (checking each Velocity changes) for my use, but to make each time a lot of calculs (divide velocity) would make it crash. If I'm using my own timer, it would not go at right speed (for exemple if normally the speed of a vehicle increase of 1 km/h each 0.001 seconds, I would have to do a 0.001 seconds timer to ensure no lag while driving, what is really too much). I hope you understood what i'm trying to explain.

Yes I do, but don't forget OnPlayerUpdate won't be called when a player is in a vehicle and accelarates.
But it will be called when a vehicle pos changes.

Forum Jump:

Users browsing this thread: