Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by Gumpert · May 11, 2015 at 08:56 PM · physicsrigidbodylayersmatrixtorque

Compute inertia tensor based only on colliders in same layer as parent?

Hi, sorry about the confusing title, I really don't know what to call this question...

Ok, so, I'm making an airship. It's a rigidbody with gravity disabled. The parent game object has the rigidbody component attached as well as a sphere collider. I placed and scaled the sphere collider based on how I wanted the airship to behave, basically, I made it quite big and centred it around where I wanted the centre of mass to be. I made it big so that the airship would have quite a high... I think it's called moment of inertia or something? Actually I don't think it is... I'm doing a-level physics and further maths, but I haven't covered this yet, I think I will next year. I know that there's angular momentum as well as momentum in a direction, and that the formula for it is going to be something like rotation speed mass some measure of how spread out the mass is.

Well anyway, I stuck this sphere collider so the parent, but I also have a load of colliders on the ship for the player to interact with - it's first person, you can walk around the ship (like in guns of icarus). So, I didn't want the player to interact with the big sphere collider, so I did some stuff with layers, so that the parent is in a layer called "airship", all the child colliders are in the default layer. I set it up with the collision matrix thing so that they don't interact with each other. Oh, and the player's in the default layer too.

Anyway, I have some child colliders which aren't closed shapes, for example, the floor of the airship. It's just like a flat thing. Now, originally, everything worked fine. The airship behaved based on the big sphere collider, the player could walk around on the airship floor. But then, I built the game for windows for the first time. I think something strange happened then, but now when I press play, the airship rigidbody's inertia tensor thing and centre of mass are all messed up. Since the floor doesn't have a volume, it gets all confused and just sets the centre of mass to 0,0,0 and the inertia tensor to (i have no idea how these work) something that means the mass is all really bundled up in the middle. Basically, when I try to turn, the ship spins super fast. It gives me this 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!

It's fairly clear that this problem is coming up because when unity tried to compute the mesh inertia tensor, it's looking at the colliders of the airship gameobject's children. I don't want it to, and it didn't used to - the airship gameobject itself has no mesh collider or anything. It's only components are rigidbody, sphere collider, and a script i use to control it. What I want it to do, and presume that it used to do is to calculate the inertia tensor taking into account the collision matrix. If it did that, it's see that the child colliders shouldn't interact with the airship rigidbody, and everything'd be fine.

I did some tests - I tried deactivating the non-closed mesh colliders, and suddenly it all worked fine. Well, except that the played just falls through the floor... but yeah, this proves that that's the source of the problem. I would just replace them all with box colliders and stuff, but the floor has like a ramped part, and the edge is a weird shape, and stuff like that, so a box wouldn't fit.

Wow... this is really long... sorry about that

Thats basically it. I've looked in the physics project settings and there doesn't seem to be any settings relative to this. I have tried just setting the inertia tensor manually in script, but it just feels like i'm treating symptoms and not actually fixing anything. It still gives me the error message and everything. Also the centre of mass is still messed up...

Well if you read all that, thank you very much, you're a very patient human! But yeah, any help would be greatly appreciated.

Thanks,

James

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

19 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there any way to keep increasing an object's angular velocity? 1 Answer

Aligning 2 Quaternions Using Torque 1 Answer

Missiles attached with FixedJoint cause too much torque for airplane physics 1 Answer

AddTorque not increasing relativeVelocity magnitude of a collision 1 Answer

Getting physics ignorance layers from script 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