why can't i divide rb2D.velocity.x by rb2D.velocity.x? [Fixed]

I’m trying to make an enemy lean to the rb2D.velocity.x by dividing it by rb2D.velocity.x which equals 1 and then do 1 * -12.5f but it only say an error saying : Assertion failed on expression: ‘CompareApproximately(SqrMagnitude(result), 1.0F)’

Hello,

it would be easier to help you with the code you made.
On the other hand, if you divide A by A, why not use 1? (The only case where A / A! = 1 is when A == 0, for which we have an indeterminate form)

@jmhoubre, thank you for answering, but apparently, the bug wasn’t coming from the code it was from the A* pathfinding I was using, apparently, the A* pathfinding I was using didn’t use rigidbody2Ds so it didn’t change the velocity.x of the rigidbody which was why it didn’t work