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 BitMiller · Dec 15, 2010 at 05:44 PM · rigidbodyattachconnectrigidbodiescompound

How to create compound rigidbodies?

I would like to reach the effect of for example putting/spawning a stone on the back of a truck. I'd like to behave it realistically. Searched almost everywhere, couldn't find an answer... Parenting two rigidbodies or turning ON isKinematic on the child doesn't do the trick. I also can't use altering the transforms, nor MovePosition. I really hope there's a reasonable solution out there somewhere.. Pleeease helppp!

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
4

Answer by skovacs1 · Dec 15, 2010 at 06:31 PM

Did you consider reading the documentation on physics or rigidbodies? They clearly state:

You should never have a parent and child rigidbody together

Consider what you want to do. You have a rock on the back of a truck, but what keeps the rock on the back of the truck? Friction which cannot exist without the forces of gravity, the materials' surfaces' effect on friction, and collision.

  • Without the force of gravity pulling your rock down onto your truck bed, there would be no collision and no friction. When your truck moves, the rock would just float there without any forces acting upon it. Note that gravity is dependent upon mass.
  • With a material that has little to no friction (like ice), even with gravity, your rock will just slide right off.
  • Even with friction and gravity, unless your object is of an extreme density and/or your fiction is to the point of being glued down, rocks won't sit in the truck for long, hence all the rock chips in peoples' windshields. Depending on your setup, you may need something to hold the object on the truck, be it the tailgate or some straps in case it slides around.

What does this mean? To behave somewhat realistically:

  • Your rock rigidbody needs gravity and the mass should be set appropriately.
  • Add approrpiate physic materials to your colliders
  • Ensure that your colliders and the rest of your scene are setup correctly.

There are all sorts of things that aren't properly emulated within physics simulation, like aerodynamics and buoyancy for example so it will never be perfectly realistic.

If you don't care how the rock behaves once it is in the truck, you could always add code to remove the rigidbody and parent the truck to the rock OnCollision if you like.

Comment
Add comment · Show 2 · 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 BitMiller · Dec 15, 2010 at 08:03 PM 0
Share

$$anonymous$$y seeing on this problem is unsolvable without a trick is strengthened. The level of realism is a misunderstanding. I don't want the stone to move an inch but to pull the truck's butt sideways in tight corners. Or: couldn't I make a see-saw with totally fixed parts, with seats on each side via runtime changeable masses?

avatar image skovacs1 · Dec 16, 2010 at 05:22 PM 0
Share

You want the rock to not move, but the rear of the truck to swing out in tight turns? Ignoring the flaws with the realism of that, to get the physics engine to generate that behaviour may require a more complex setup, but the one you describe seems incorrect as mass isn't really changing per side. Essentially, you'll want shift your centerOf$$anonymous$$ass and be very picky about how and where you apply forces. If your truck is kinematic, then you'd likely have to fake this faux inertia yourself.

avatar image
0

Answer by Iamdain · Oct 05, 2012 at 02:57 PM

@Gil the short answer I believe is that the way to go about what you want to do is to:

a) Increase the mass of the truck object itself each time an object is added b) Change the centre of mass of the truck (including rocks) by hand to account for the new weight distribution

Part b will require understanding centre of mass calculations for discreet objects, see centre of mass for particles here http://hyperphysics.phy-astr.gsu.edu/hbase/cm.html

Might be confusing if you're not familiar with physics concepts but Physx doesn't have any way to 'weld' or compound rigidbodies together in a way that preserves their respective mass distributions to my knowledge...

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 whydoidoit · Oct 05, 2012 at 02:59 PM 0
Share

It does create combined objects out of child colliders - but those items are not going to be physically interacting with each other. For example a stone applied to the truck could be added as a new collider and the mass of the truck increased as you suggest - this would automatically move the centre of gravity etc.

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

2 People are following this question.

avatar image avatar image

Related Questions

How performance-intensive are rigidbodies? 2 Answers

Attaching Rigidbody breaks gravity 1 Answer

Inconsistent gravity/random forces/solver problem? (forum crosspost) 0 Answers

Simulating wheels without a wheel collider? 1 Answer

How to stop Rigidbody characters from sliding off rigidbody platforms? 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