Maximum angular/linear velocity

pretty much the title. i have a physics object in a game i’m making, and i’d like to limit its linear speed and angular speed so that it doesn’t fly out of control. i know there’s damping for both attributes, but those just slow down angular and linear speed. i’d like to set a barrier (for example, speed on the x/y axis can’t be above 100 pixels per second, or something like that). how can i do this? thanks

I think not tested but this should work just use clamp() to set the minimum/maximum linear speed you want


i’ve tried this out and it doesn’t seem to have the desire effect–what does each value stand for?

[edit] corrected, as pointed out by @Muzan
clamp(<Minimum Value>, <Maximum Value>, <Value To Evaluate>). Put your velocity as the last parameter.

clamp(<Value To Evaluate>, <Minimum Value>, <Maximum Value>). Put your velocity as the first parameter

This is a screenshot I took from Wiki

Here it is clamp(<Value To Evaluate>, Min Value, Max Value)
Or its something like this, clamp(Object.Physics2::AngularVelocity(), min value, max value)
clamp(Object.Physics2::LinearVelocity(), min value, max value)


excellent, thank you. what should the condition be for the event?
should i trigger the event when the objects angular/linear velocity surpasses the max speed?

It should be an action. An action to change your preferred velocity to clamp(Object.Physics2::PreferredVelocity, min value, max value)

Note: PreferredVelocity means what you want, Angular or Linear Velocity

the object’s velocity will vary throughout the game, though, since it’s the player character. the “clamp” action seems to rotate the object at a constant speed (this would be nice for a stationary enemy/obstacle, but not in my use case).
i just wanted to set a restriction on how fast the player’s angular velocity can travel. how can i do this? thanks

Try to add a condition like
Player.AngularVelocity < X where X is the maximum you want to restrict
–>Here update the force of the player so if is less than x will do

1 Like

Yes, it will set a restriction. See here
There I did this

And we see that it suddenly starts to rotate at a constant speed but now, see here
It starts to rotate slowly and speeds up, but doesn’t always speed up, there is a limit on how fast the character can move. You just need to find the right combination like this

1 Like

you were right, i just had to mess with the maximum velocity a bit to find the sweet spot. thanks again everyone!

Good that you got it :grinning::+1:

1 Like