How do I identify my object when stopping?

Is there any way for me to identify if my object is stopped? This is because the box is falling and not to when she altogether.

1 Answer

1

I assume you are talking about a Rigidbody.

if (rigidbody.velocity == Vector3.zero) {
    Debug.Log("I'm stopped");
}

Depending on what you are doing, you may want to use a threshold:

if (rigidbody.velocity.magnitude < 0.02) {
    Debug.Log("I'm stopped or moving very slowly");
}

very minor thing, I think: rigidbody.velocity.sqrMagnitude < 0.02*0.02 would be slightly more efficient, and as you would probably be doing this in Update it might actually help.

–