Is it possible to add a speed limit when using torque for movement?

Hi, I’m currently building a game based off of the rolling ball template. I’ve made a few tweaks to the balls blueprint to shift it to a 3rd person controller but the movement is essentially the same as the default BP.

I’m currently trying to work out a way to set a max speed for the ball while keeping the torque value relatively high. Lowering the torque speed does reduce the max speed but also reduces the acceleration and general movement speed making the ball feel sluggish.

Ideally, I’d like to find a way to monitor the balls current speed along a given vector and prevent further torque being added until the speed has fallen below a set amount.

I’m not really accustomed to working with vectors as values and I’m not entirely sure of their effect but most recent attempt is this:

The section at the top for the boolean is supposed to be:

If the float “Max Speed”, divided by the current velocity of a given vector is less than or equal to 1, then “Speed_Limit_[Axis]” equals true.

with the added check of;

When “InputAxis Move[Right/Forward]” is pressed, check corresponding “Speed_limit_[Axis]”, if true, do nothing, if false add torque.

I’ve tried a number of values as Max Speed with no discernible difference to the balls control which leads me to think that there’s something about vectors that I don’t know that’s affecting the outcome, or that the idea behind this is flawed.

In either case, any help would be much appreciated.

if you go into the ball mesh blueprint, check out the details panel for the mesh, and look at the physics category. expand the category to show the advanced details (the little arrow pointing down), and check ‘Max Angular Velocity’. there you can set a value that limits how fast the ball spins, the result of which will cap your velocity no matter the amount of torque.

Thank you, this one helped me too! :slight_smile:

you can use max angular velocity to limit the ball

291892-look-for-this.png

1 Like

The set variable nodes need to be connected to the execution, otherwise the compiler will ignore them. So you need to move the execution flow from the initiating event through both of your set variable nodes, then into the if/branch. That should fix your problem.

Thanks for that.