How do you apply a torque curve in Godot?

Godot Version

4.2

Question

I am playing around with Vehicle3D and I am keen to be able to limit the speed of each vehicle with a torque curve of some sort. In Unity, I have used it before where you can create a curve that represents the torque-to-speed ratio.

Which should be inversely exponentially related, so the higher the speed, the lower the torque that can be applied. This is to make the acceleration gradually decrease as the vehicle speeds up. And you would then just look up the value based on the current speed and apply that torque * to the player’s input.

Any suggestions on how to achieve this in godot?

Sorry, did find it after even more googling :rofl:

Seems you can use a curve as an exported variable and then create a new curve and apply it to the script, then use interpolate to get the value

@export var torque_curve: Curve

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.