[\unity\stuff\external-source\physx\novodex\SDKs\Physics\src\NpActor.cpp line 150]
Thats it, all the steps, nothing special.
This is on Windows
I’d file a bug if I had more info, but this is about it, all the info I got, if I am still having this issue in another week, I’ll bug report it, maybe if someone else can reproduce then its worth a bug report, other than that, everything works.
I have only experienced this one time so far, and the fix was to just remove the rigidbody and meshcollider from the object and add it back to the object.
It didn’t crash Unity, so the bug report won’t show anything really other than normal Unity running info. The only data I have is what is posted and the only steps to reproduce it is what is posted. I haven’t been able to reproduce it as of yet, but I am starting to suspect what might have caused it to begin with.
I suspect that since I imported the model, applied the rigid body to the model, applied the mesh collider to the model, created a new prefab, applied this to the new prefab, then scaled the model up by 10x10x10 (x,y,z), that the code tried to send the new scale infomation to the collision model in the PhysX physics world from the game world and the PhysX physics world puked on the model scale, now, when I destroyed the rigidbody and the collision model which in turn destroyd them both from the PhysX world, then I added both the rigid body and the mesh collider back to the already scaled model and applied it back to the prefab, it took the new generated collision model.
This is how you have to deal with collision models anyway, doesn’t matter if it is Newton, ODE, or PhysX, you can’t scale (or rather should not scale) the physics model in the existing physics world. Technically the collision model should be a static size and shape for proper collision checking. I just assumed that Unity automatically destroys the model in the physics world and recreated it when the model with a physics object is attached to it.
The proper way to handle a scaled object with physics attached to it using PhysX engine is as follows:
destroy the physics model info from the PhysX world
recreate it after scaling is complete
Every model with a physics entity attached to it should follow those 2 steps when they are resized.
I ran into this error message with a rigid body attached to a mesh collider in the shape of a bowling pin. So I searched and found this old thread, which says the error isn’t fatal - Unity will use a default inertia tensor if the computation from the mesh fails.
Also, there seems to be a general implication that it’s preferable to use primitive colliders with rigid bodies (in the doc, I recall it says rigid bodies are “usually” used with primitive colliders, though it doesn’t say whether that’s for performance reasons or to avoid this type of error).
I played around with the PhysX SDK a while back for another project (it’s well documented by the way, so it’s worth downloading) and I remember I ran into this error instantiating PhysX “actors” without specifying the right combination of mass, density, volume, etc. Maybe in Unity this could be avoided by exposing more properties in the RigidBody component.