Closed haubna closed 3 years ago
You are releasing your convexMesh and material to early (in lines 149 and 150, convexMesh is even released a second time in line 152). These objects are used by PxConvexMeshGeometry
during simulation afterwards and if they are already released this results in undefined behavior and/or a crash. Since this happens in native code outside the JVM there is also no stack trace or other kind of error message (that's the 'beauty' of native code development...).
Fix is easy: Keep the references to convexMesh
and material
and release them in the end (when scene
and the other stuff is released). For the material you can also re-use the material created in the main method before, instead of creating a new one for the convex mesh.
Still crashing unfortunately. Code that causes the crash: https://pastebin.com/xcaLuuPD
I have also tried to keep everything in memory from the Convex Actor (and not calling there destroy() functions) and it still crashed.
Ah this is a weird bug I experienced myself a while ago: For some reason it is required to clear the eENABLE_PCM flag on scene creation. I have no idea what's the reason for that, but it seems to be a PhysX problem (maybe related to my build setup, compiler / optimization settings, I don't know...)
The workaround is to not use PCM (uncomment line 26) then it should work fine.
Ok thanks! :)
I've rebuilt the PhysX libs and it works now (as suggested in your how to build it by yourself)! Link to the builds (only windows builds): https://drive.google.com/file/d/1kCBU_WKI5g0pnJ_EwDe7vp2si4dBWjDe/view?usp=sharing https://drive.google.com/file/d/1AmLDzl9W2ukVgU-ez_RcCAT7zhj_mbB6/view?usp=sharing
Thanks for the info! I reinstalled my Visual Studio and now my build seems to work as well. Update should be up soon...
I am not sure why but this code (extended sample code) crashes when using the convex shapes. Creating no log whatsoever and it doesn't even crash all the time. I might be using the API wrong though.
https://pastebin.com/21gDbdpE