I have a 3d dynamic node with speed & acceleration vectors. It has maximum speed (magnitude) and minimum speed such as if it exceeds maximum or goes below minimum, it stops accelerating and the speed is set to the respective maximum or minimum.
I have no problem detecting the maximum, I just have to check if the magnitude of speed vector is superior to the maximum.
But I am struggling for the minimum detection, magnitudes being in the positive field it seems to me more tricky. For example I want a minimum speed near 0, or 0, the object is decelerating, at one point it will pass through 0 and start accelerating following acceleration vector.
For example speed magnitude could be as such through frames: 5, 4, 2, 1, 3, 6 .. etc
There is no way to know if it did pass through zero, it could have well passed over zero between 2 and 1 and accelerate after, or between any other number.
Each frame I have these data: last speed vector, actual speed vector, acceleration vector.
How can I detect that next frame I'll cross my minimum value (zero in that example) ?