Hi
Is there a way to limit the speed of my vehicle to let’s say 150km/h without changing the rpm or acceleration?
Because currently when I limit my speed it uses the last gear ratio to determine my max speed but the built up towards the max speed is very slow and I want it to reach max speed in a couple of seconds.
Most of the time my vehicle should be limited to 150km/h but there are some areas where I want to be able to remove the limit and allow speeds of over 200km/h. So, I tuned the rpm etc to be able to drive at really high speeds but I am unsure how to limit it.
The speed of the vehicle is limited by the maximum speed that the wheels can spin round and that is limited by the gear ratio and the maximum engine rotation speed. The theoretical limit is as follows:
maxWheelRotationSpeed(currentGearRatio) = maxEngineOmega/(currentGearRatio*finalRatio);
maxVehicleSpeed(currentGearRatio) = maxWheelRotationSpeed(currentGearRatio)*wheelRadius;
These are theoretical limits because engine power is lost to engine damping, wheel damping, rigid body damping and imperfect translation of engine torque to tire force. Some power is lost to the simulation itself due to the step size of the integration.
If you want to increase the maximum speed then you would need to either increase the maximum rotation speed of the engine or decrease the gear ratio. I would recommend adding an extra gear that has a low gear ratio and then toggling the number of gears on the vehicle so that the extra gear is either accessible or inaccessible depending on your game logic. You could obviously do the same by toggling the max engine rpm between two values depending on your game logic. However, that might sound strange if you have audio that reflects the engine rotation speed.
Cheers,
Gordon
Hi
Thank you for your advice.
I’ve tried out both of your suggestions and I am not entirely statisfied with them.
I am trying to create a certain type of simulator and in real life they use an electronic control speed limiter and I was wondering if I could implement something like this:
the speed limiter device get the speed value from a speed signal wire and once you go over the allowed speed, the device will control the injector fuelpump and reduce the fuel supply.
Does Nvidia PhysX have options to limit fuel supply or do you think it would be possible to do it this way?
I’m afraid PhysX vehicles have no sense of fuel supply.
Reducing the fuel supply is pretty much the same as reducing the available engine torque. You can reduce the engine torque by simply reducing the input analog throttle value. I’ve seen many examples where physx vehicles are controlled this way to maintain a constant forward speed.
const float forwardSpeed = myVehicle.computeForwardSpeed();
float throttle = getThrottle();
if(forwardSpeed > limitedSpeed)
{
throttle *= alpha;
}
Cheers,
Gordon
Thanks for getting back to me so quickly.
I am not entirely sure what you mean with the alpha value. Could you elaborate?
Thanks for the help!
Sorry, should have made that clearer.
Alpha woud be any value less than 1.0. Bsically, the player tries to accelerate but you want to limit their ability to accelerate if they are at the speed limit. A hard limt would be rigidly enforced if alpha has value 0.0 but that might generate off-on stuttery behaviour. You probably want to filter the values being passed to the vehicle to smooth them out over time. That will soften the limit but lead to smoother behaviour. It really depends what you want to achieve.
If you want more detail, I’m imagining setting alpha to be linearly interpolated between two speeds ie alpha has value 1.0 as speedLimit - 1.0 and value 0.0 at speedLimit + 1.0. You can vary the slope of the interpolation as you wish to blend between a hard limit and a softer limit.
This will just require some experimentation to get it the way you want it.
Cheers,
Gordon
The speed of the vehicle is limited by the maximum speed that the wheels can spin round and that is limited by the gear ratio and the maximum engine rotation speed. auto news