Is it elegant to use .drag to stop a rigidbody?

You have a rigidbody with a velocity of 1.715 m/s, it could be heading any direction. Perhaps think of it as drifting in space, or, moving in some way on a surface.

(It is not necessarily heading .forward - it ay be crabbing around or even tumbling etc - so AddRelativeForce may not be relevabt.)

You want this little devil to come to a stop … in all circumstances, no matter what it is doing.

You can, I suppose, just set rigidbody.drag - in a way that;'s quite elegant. Regardless of the direction, what it’s doing, etc, it will quickly stop in a gooey manner. (As a bonus angularDrag would be quite hard to write by hand.)

But in other ways it seems rather inelegant - how and when do you set the .drag back to normal? What if another process wants to kick it along in the meantime? And so on.

It would seem to be an extremely commonplace need … “make an object slow down and stop naturalistically” Am I missing something obvious?

Should I just shut up and write this by hand in all situations? Is there an elegant way to deal with cancelling the concept I’m missing?

It’s almost like … t would be great if you could put it to “sleep + honey drag” … and in much the same way as sleep, if someone added force to it it would completely wake up on it’s own accord.)

Cheers !

Associated: I don’t suppose any knows the units or sensibility of rigidbody.drag? How much to apply give velocity to stop in given time?

The rigidbody “energy” is stored in their properties velocity and angularVelocity. If you zero them, the rigidbody stops. You may implement an artificial kind of drag to kill its energy without altering drag or angularDrag, and apply it in a coroutine, like this:

public var killSpeed: float = 0.9; 

function StopMe(): IEnumerator {
  while (!rigidbody.IsSleeping()){
    // kill rigidbody energy each physics cycle:
    rigidbody.velocity *= killSpeed;
    rigidbody.angularVelocity *= killSpeed;
    yield WaitForFixedUpdate(); // resume next physics cycle