clamping physics based speed

I have a physics based object (a ball) with 0 friction and 1 restitution. The ball behaves the way that I want it to, except that when it’s hit, occasionally it takes off way faster (or way slower) than I want it to.

What I’m trying to find is some way to clamp the speed of movement of this ball. Am I going to have to ditch using physics and move the ball myself, or is there a way to clamp the speed of a physics object to some sort of minimum/maximum speed? So far I’m unable to find any information on this.


There is property to limit physical speed.

But you can cheat system:

  • read that object velocity (get physical velocity) it is vector that determines speed and direction
  • then get length of that vector lenght is just speed.
  • compare to your desired speed
  • if current speed is less than desired speed add impulse that is: “normalized velocity vector” * “some positive value”
  • if current speed is more than desired you just do opposite ie add impulse that is “minus some value” * “normalized velocity vector”
    for doing smooth in and out try to mapping that trough “float function”

You get those strange acceleration incidents when collision overlaps. In that case something in unreal overwrites location of ball to “Correct” uncollidiong location. For physics engine it is sudden change of location (from frame to frame) of some 1-5 units. Because it happens over single frame physics calculates it as sudden huge acceleration, and shoots your object into space.
So avoid any overwriting of physics objcet velocity or location at any cost, instead manipulate everything with “add force” and "add impulse.