• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
16
Question by Novodantis · Nov 17, 2009 at 12:12 PM · errorphysicsinertiatensor

What does the "compute mesh inertia tensor failed" error mean?

I have a simple "third person cam" space shooter using a GameObject which contains a valid 3D ship mesh, and various planes used for effects (engine glow and crosshair).

I would like the position of this object to be defined by an invisible rigidbody sphere. However, when I place the rigidbody sphere at the top of the GameObject, I get compile errors:

Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually!

Apparently this is caused by the auto-tensor-assignment process, which trips up on zero mass meshes (ie. the planes). I don't want these hackily put in seperate game objects and positioned each frame. Is there any way I can get this to behave? I'm sure the Tutorial has rigidbody objects containing sprites but I can't seem to figure out what part I'm doing differently. I tried adding a line on Awake() to set up a default tensor manually, as such:

rigidbody.inertiaTensor = Vector3(1, 1, 1);

But that didn't fix it either. Anyone got any suggestions?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image bernardfrancois · Jun 13, 2011 at 11:08 AM 0
Share

I had the same error after adding a rigidbody to a plane, to be able to do a raycast on the plane. I could ignore the error without any noticeable consequences. There may be other consequences though (perhaps memory related issues), but as it was for a gameplay prototype, I had no problems ignoring the issue.

avatar image Eric5h5 · Jun 13, 2011 at 04:31 PM 2
Share

@bernardfrancois: raycasting does not depend on rigidbodies, only colliders. Remove the rigidbody from the plane.

avatar image Brian-Brookwell · Aug 02, 2014 at 09:26 PM 0
Share

I've been getting the same message. I'm generating a terrain as a mesh of triangles. It has no enclosed volume and physics collisions between it and other mesh objects don't seem to work properly (i.e. the object drops straight through). I have put a mesh collider on the terrain. When I added a RigidBody to the terrain though, that's when I started to get the mesh tensor error. I'm looking at two possible approaches:

1) Creating a base plane and make the terrain an actual 3D object ins$$anonymous$$d of distorted plane. This is doable though messy as it'll add a large collection of non-visible triangles 2) Calculate the mesh tensor myself. Have no idea even where to begin this process.

$$anonymous$$y question is: has anyone had this problem and how was it solved?

avatar image Eric5h5 · Aug 02, 2014 at 11:23 PM 1
Share

You should not add a rigidbody to the terrain. Rigidbodies are only for moving objects.

$$anonymous$$esh colliders do not collide with other mesh colliders. $$anonymous$$oving objects should not use mesh colliders; they should use primitive colliders or compound primitive colliders. (Or convex mesh colliders as a last resort.)

6 Replies

· Add your reply
  • Sort: 
avatar image
6

Answer by $$anonymous$$ · Nov 17, 2009 at 08:09 PM

Do your child game objects have colliders attached? A game object that has children with individual colliders will collectively act as a compound collider (this is described somewhere in the Unity Manual in the Physics section - it's a technique to create collision shapes more complex than a sphere or cube), so if you have zero-volume plane/mesh colliders and a parent rigidbody, that might account for the warning. So I suggest you remove any colliders you really don't want or selectively replace them, e.g. replace a mesh collider with a box collider with non-zero width/height/depth. Or rearrange your objects is the children don't really need to be children.

If you still want to set the inertia tensor explicitly, you made the right call - here's another example setting it for a cylinder shape (extracted from some game physics book). But this is more appropriate for a refinement phase after getting the physics to basically work right and error-free.

function SetInertia() {
var inertia:Vector3;
// cylinder
inertia.x= rigidbody.mass*(1.0/12.0)*h*h+ rigidbody.mass*0.25*r*r;
inertia.y=  rigidbody.mass*0.5*r*r;
inertia.z = inertia.x;
rigidbody.inertiaTensor = inertia;

}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • ‹
  • 1
  • 2

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Disable inertia tensor calculations on rigidbody? 0 Answers

Compute the torque needed to rotate an object at a constant rate 3 Answers

How to calculate inertia tensor and tensor rotation manually 2 Answers

Wierd Internal Physics problem 1 Answer

CapsuleCast consistent error in size 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges