A Tricky Problem Force and Velocity

I think everyone uses velocity in order to get if an object is applied force, right?

The problem is after i apply force to a rigidbody and check its velocity. Unity says it is not moving. Yes it is not moving but it was applied force. For this delay my code thinks the object was applied force and stopped moving since it is not moving. This causes my code to run the code before the object starts moving while it should after the object stops.

ExampleCode
if(ObjectWasAppliedForce())
{
if(ObjectNotMoving())
{


}
}

Which i think is caused by “the force that is applied to a rigidbody takes effect after one frame” or “since physics and render updates are not synced it happens”.

How can i overcome this? I am really out of solutions. If i cant find any solutions, i will try a workaround, which is i hate to do.

Thanks in advance.

Create a list of rigidbodies to which you applied a force, or maybe add a script to all rigidbodies where you can set a flag that a force was applied. After you “consumed” that information, you need to reset it.

Thanks Dantus. So basically there is no solution, only workarounds. :frowning:

That is not a workaround. Rigidbodies don’t have have a “sensor” to detect when forces are applied. What you are looking for simply doesn’t exist. When you apply a force, the velocity will be changed before the next FixedUpdate. But there is no way to find out when that force was applied. The proposed solution is the only reliable way I can think of.