Using an iPhone 3G and XCode 3.2.
Mathf.Approximately (1.0, 10.0/10.0) returns TRUE as expected at Unity Remote.
Returns FALSE (incorrectly) at the XCode debugger causing game logic errors.
I’ve noticed that Mathf.Epsilon returns 0 at the iPhone.
Help?
I’ve submitted it as a bug.
In the meantime I’m using:
function ApproxEqual (to : float, val : float, epsilon : float) {
var result : float = (to) - (val);
if (Mathf.Abs(result) < epsilon) {
return true;
} else {
return false;
}
}
ApproxEqual (1.0, 10.0/10.0, 0.001) returns true as expected.
Same here.
My code works on editor but not on device.
I’m using expressions like
if (Mathf.Approximately(Time.fixedTime % 1f, 0.0f))
and
if (Mathf.Approximately(volume, 0f))
What’s the latest news on this, it seems the bug is still present…
The code I put in my first post should help everyone out for the time-being, else where are the Unity Support team? This thread has been open for ages.
Griffo
July 18, 2011, 10:53am
5
Hi, I’m having the same trouble with the below code checking for joystick movement, any help would be gratefully appreciated.
if(!Mathf.Approximately(movement.y, 0) || !Mathf.Approximately(movement.x, 0))
swiv
February 7, 2012, 11:31am
6
I’m having this problem too… has it really not been fixed in over 16 months?
The bug is related to the fact that iOS puts VFP into faster, but less accurate mode. We implemented workaround in Unity 3.5.
What’s the workaround? Using Mathf.Approximately still chokes out on 3.5.2.