JME 3.8.0-beta1

Hi guys,
I’m looking into the AudioNode.updateGeometricState() method. I noticed that the !Float.isNaN() check for the previousWorldTranslation seems to only examine the x component. Is there a specific reason why the y and z components aren’t also checked for NaN?

1 Like

My best guess is that they only checked the X component for being NaN because usually a bug causing a NaN vector makes the whole vector NaN. Especially if you are just using a vector normally and are not modifying the x/y/z components individually. But depending on the use case it certainly would be possible for y or z to end up NaN while x is valid.

There is a static Vector3f.isValid() method that checks the whole vector for any NaN floats: jmonkeyengine/jme3-core/src/main/java/com/jme3/math/Vector3f.java at master · jMonkeyEngine/jmonkeyengine

So I’d say this Vector3f.isValid() check should probably be used here instead of Float.isNan(x)

4 Likes