fabmax / physx-jni

Java JNI bindings for Nvidia PhysX
MIT License
88 stars 9 forks source link

Articulations NaN #20

Closed haubna closed 3 years ago

haubna commented 3 years ago

I am trying to work with articulations and there position values somtimes return NaN (running the code returns random results). I've purposely excluded releasing the memory to avoid having a mistake on those. Currently it creates only the main articulation body and even this one only returns NaN. This is the file for quick tests:

https://pastebin.com/9DJDUMpr

fabmax commented 3 years ago

I haven't tested it, but what could be a problem is that you don't initialize your pose orientations. The default constructor of PxQuat doesn't do any initialization, so these will be random. You should initialize them with new PxQuat(0f, 0f, 0f, 1f); to set them to identity.

haubna commented 3 years ago

Oh wow, I've struggled with this like 6 hours (on a bigger project). Always thought it initializes it like that (I am used to it from JOML). Works like a charm. Thanks for the quick response!