P
PWL
Guest
I wish I could use this for controlling my xSpeed, but strange things happen to it.
The point is to slow down xSpeed to 0 eventually, no matter if it should decrease from 9 or increase from -7.
However, sign(xSpeed) is not always 0 even though xSpeed validates to 0.
Can someone tell me how this thing still shows a message?
The point is to slow down xSpeed to 0 eventually, no matter if it should decrease from 9 or increase from -7.
Code:
xSpeed = xSpeed + (-sign(xSpeed) * 0.01);
Can someone tell me how this thing still shows a message?
Code:
if(xSpeed == 0 && sign(xSpeed) != 0){
show_message(xSpeed); // Output: -0.00
}