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
1
Question by Bumbaz 1 · Apr 27, 2011 at 08:59 PM · rigidbodymeshcombine

Combine multiple rigidbodies?

Hello there. I was wondering, what is the best way to approach this problem? I want to combine two or more different rigidbodies into one at runtime, or if that is not possible without a complex use of the Mesh class, to make them act as one? Picture shows what I mean, since I am not good with words:alt text

They would need to follow the physics as if they were a single object, mass caclulations included. Thank you in advance.

~Bumbaz

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Eric5h5 · Apr 27, 2011 at 09:15 PM

If you remove the rigidbodies from the cubes (but keep the colliders intact), and make them children of an empty gameobject that has a rigidbody, then they will be effectively merged. You'd want to add the mass from the two cubes before deleting the rigidbodies and apply that to the mass of the parent.

Comment
Add comment · Show 5 · 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
avatar image Bumbaz 1 · Apr 27, 2011 at 09:43 PM 0
Share

That's very helpful, thanks. But what if I have gameobjects with different masses? In the method you described, the center of mass is only one. Is it possible to assign different weights to different parts of this one gameobject?

I am so bad at words. Haha

~Bumbaz

avatar image Eric5h5 · Apr 27, 2011 at 09:52 PM 0
Share

@Bumbaz: No, that wouldn't work with the method I described. I'm not sure there's an easy way to do that.

avatar image Chris D · Apr 27, 2011 at 10:11 PM 0
Share

what if you only parented them to the new gameobject but retained their original rigidbodies? Wouldn't that also retain their weight distribution?

avatar image Eric5h5 · Apr 27, 2011 at 11:32 PM 0
Share

@ChrisD: that won't work, since the rigidbodies would still be independent. In order for compound colliders to work, only the parent can have a rigidbody.

avatar image eliweston · Apr 09, 2018 at 06:53 PM 0
Share

How would this look in code.

avatar image
1

Answer by klay · Sep 07, 2012 at 08:32 PM

Maybe you need to look at a fixed joint:

http://docs.unity3d.com/Documentation/Components/class-FixedJoint.html

This is used to "connect" two distinct rigidbodies together. Each maintains its own mass, but pushing on one rigidbody pulls on the connected one, so they act sort of like a single physics object.

There are other types of joints as well: hinge joints, spring joints, etc.

Comment
Add comment · Show 1 · 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
avatar image TruffelsAndOranges · Nov 23, 2014 at 11:42 AM 0
Share

That is only for 3D physics.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

combining meshes 0 Answers

Combine Children and Unity 4.0.1 not working the same as in previous version 0 Answers

How do i test whether my box collider is touching the floor or not? 2 Answers

Rigidbody stuck in corners of Mesh Collider 0 Answers

Combine Mesh but Keep UV Offset & Scale 0 Answers


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