Unity 2.5 Placed FBX object, added Mesh Collider,..

Getting Actor::updateMassFromShapes error

Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor’s mesh shapes! Please change mesh geometry or supply a tensor manually!
UnityEngine.Transform:set_localRotation(Quaternion)
UnityEngine.Transform:set_localRotation(Quaternion)
UnityEngine.Transform:set_localEulerAngles(Vector3) (at C:\builds\unity-trunk\unity\Runtime\Export\Generated\BaseClass.cs:572)
UnityEditor.TransformInspector:OnInspectorGUI() (at C:\builds\unity-trunk\unity\Editor\Mono\Inspector\TransformInspector.cs:103)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ])
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ])
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[ ], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[ ])
UnityEditor.InspectorWindow:OnGUI() (at C:\builds\unity-trunk\unity\Editor\Mono\Inspector\InspectorWindow.cs:351)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ])
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ])
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[ ], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[ ])
UnityEditor.HostView:Invoke(String) (at C:\builds\unity-trunk\unity\Editor\Mono\GUI\DockArea.cs:156)
UnityEditor.DockArea:OnGUI() (at C:\builds\unity-trunk\unity\Editor\Mono\GUI\DockArea.cs:491)

[\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.

Please bug report whatever you’ve got. The bug reporter will automatically include any logs generated by Unity and details on your hardware and OS.

Also include your project folder in the bug report if possible.

All this will assist UT in identifying the error.

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:

  1. destroy the physics model info from the PhysX world
  2. 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.

http://forum.unity3d.com/viewtopic.php?t=3189&view=next&sid=dbac8825037d414ec9170ddcb2184459

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.