- Home /
ridgid bodies of different mass
I am working on a script that allows the user to assemble structures by putting together rigid bodies using fixed joints created in game, in order to create larger structures. I was having problems, and it seemed that some things made with this script would act completely erratically and the rigid bodies would basically spasm until they broke the fixed joint holding them in place.
Then I realized the root of my problem, if two rigid bodies are joined with a fixed joint, and they have significantly different masses (2:1 or more) they do not attach as expected, and usually the lighter one will begin to violently shake around the heavier object. The temporary solution is just to make all the objects the same weight, but if they don't have masses based on their size, the physics will be very unrealistic. Any suggestions?
Answer by bodec · Jun 25, 2012 at 03:53 PM
Try isKinematic. here is the link to the scripting refence to give you a better idea about it.
Thanks, but is$$anonymous$$inematic is not the answer. From what i understand is$$anonymous$$inematic basically turns the rigid body physics off, and allows for animation of rigid bodies and the attachment of a rigid body to what is essentially not a rigid body.
What I need is a way to attach two or more rigid bodies that have a large difference in mass, and have them interact accurately.
when joined does this happen if they are sitting side by side of if a heavier one is on top. does it still happen when the lighter one is on top. physics may be having a problem if the smaller one is not really suppose to be able to support the larger one and is tring to break throu.
Answer by randosity · Jun 25, 2012 at 11:32 PM
well, it seems to happen regardless of their orientation.
In the real world, the ability of one object to support another has nothing to do with mass, but rather with compressive strength. So yes, it is supposed to work like that.,
Answer by RobertVerdes · Apr 30, 2018 at 01:34 PM
Old question, but surprisingly there isn't anything on Unity Answers about:
which should be what you were after.
On a different note:
It would be helpful to start a conversation on the topic and build a proper answer. I'm still trying to understand how they should be used, the documentation skips on some details:
Assuming RB1 with mass 2 has a FixedJoint with connected body RB2 with mass 20:
If massScale = 2, does is act on RB1's mass (2 x 2 = 4), or is the joint always seeing RB1s mass as 1, and would now see it as 1 x 2 = 2?
Probably another way to ask #1 but, should we set the massScale and inverseMassScale to reflect the bodies' mass difference (1:10), or is it an extra scaling, on top of their current difference? If so:
What would be the difference between (massScale = 1, inverseMassScale = 10) and (massScale = 2, inverseMassScale = 20), and why do we need both?
What does "scaling mass and inertia is fundamentally nonphysical and momentum won't be conserved" actually mean and what does it imply?
What exactly is "inverse mass" and "inertia tensor" in the first sentence "The scale to apply to the inverse mass and inertia tensor of the body prior to solving the constraints". It's the same for both massScale and connectedMassScale. Copypaste mistake? "inverse mass" is the mass of the connected body I presume.
@randosity did you find your way? Cheers.
Your answer
Follow this Question
Related Questions
I want my Player to have collision physics 1 Answer
Having a RaycastHit event create a component? 1 Answer
rigidbodies with flight physics and autopilot - Approach? 0 Answers
Box2D force on object? 0 Answers
FixedJoint Stopping Rigidbody Physics 0 Answers