# Clamping angular velocity? In other words, setting a max angular velocity. (Bullet)

I have a ball thats getting torque applied to it, but i want to make sure the angular velocity cannot exceed some absurd numbers. I dont see an intuitive api call for this.

That would mean interfering with a physical simulation, which is unacceptable. For example, linear motion, where velocity is calculated in conjunction with gravity, suddenly you needed to limit acceleration in free fall. This no longer fits in with the concept of physical simulation.

However, you can independently influence bodies by setting thresholds based on modeling analysis, such as zeroing efforts when the threshold is raised, and so on.

I sometimes abuse this call if I want the object not to rotate, for example, the capsule stood vertically.

`body.set_angular_factor(False)`

However, this will be an unnatural physical simulation.

Thanks for the exposition, makes sense. Unfortunately, i need somewhat unrealistic physics for a better experience. If the ball is in the air, there is less friction to resist torque. If i continuebto allow torque to be applied at the level of friction the air provides, it ramps up angular velocity very quickly. When it hits the ground this has an undesirable effect if intense take off. â€śSonic build up styleâ€ť. Just as i apply linear force in air to make it feel more responsive, id like to limit the torque as well.

So i guess thinking about it differently, i can simply scale torque velocity down when in air? Ill give this a shot.

If angular factor is simple disabling, this will not work for me i think. Ill look at the docks for that as well. Thanks again.

What you might perhaps do is have the angular velocity being added by player input be scaled by the inverse of the angular velocity in the specified direction (likely as a percentage of the desired maximum).

That way thereâ€™s a limit to how fast the player can spin the ball, and which is approached somewhat-smoothly.

And I think that it makes some sort of physical sense: considering the case of feet running inside a sphere, the faster the sphere is movingâ€“and in particular, the closer to the running speed of the feetâ€“the more the two motions will match, and so the less the feet will push on the sphere. Indeed, at some point the â€śpushâ€ť will simply be travelling with the ball, and thus be having minimal effect on it.

(Note that I havenâ€™t tested this myself, and thus donâ€™t know whether it might work, or whether tweaks might be called for.)

1 Like

Intersting idea, ill look into it. For now its being ignored. The game works, ill come back to it in polish.

1 Like