- Home /
Parenting not working with massive force to rigidbody. Does having rigidbody on child screw things up?
Ok, so I have 3 objects a, b and c. a is a character, b is a hinge for a weapon and c is a weapon. c is a child of b and b is a child of a. When c hits the environment a massive force is applied to a's rigid body, sending it flying. b and c are not following a as they should instead they are just sitting at the bottom of the environment. I don't know why this is, can someone please help? Also, a, b and c have a rigidbody each. Does having a rigidbody on a child mess up how the parenting system works?
What do you mean "B is a hinge"? Hinges aren't gameObjects. They're something you add to a rigidbody gameObject, to connect to another. The hinge would be on gun C going to player B (unless you want a double-jointed hinge?)
Technically, one object "hinged" to a larger one shouldn't be a child. But I've gotten great results with child hinged rigidbodies, the same way you describe. I find childing works better when one object is much larger than the other.
There's probably something else wrong with the setup. Does everything work fine when you drop it, roll it around, give a smaller push?
By a hinge I mean since b is a sphere which is use as a center to a so c will rotate around properly. I achieved this through adding a force to b's rigidbody. I call it a hinge because it serves a similar purpose to a hinge joint. It just seems to work better in this case. Sorry for the confusion.
Answer by Owen-Reynolds · Aug 05, 2014 at 02:13 PM
Yes, having a child object with a rigidbody (and no joints -- just a rigidbody) is well-known to be no good for anything.
A regular object just sits there. If you make it a child of something, it moves/spins with the parent. If you give it a rigidbody, it moves/spins on it's own. If you give it both, it doesn't technically mess anything up -- it follows both rules -- but the result is an ugly mess. It moves completely on it's own, adding any parent movement as non-physics.
The main thing, maybe, is the child object won't get any of the parent's velocity, since that isn't the rule. When the parent goes up, it will pull the child up, but then the child's rigidbody says "I'm in the air? How? Time to start falling."
$$anonymous$$ake it $$anonymous$$inematic.
I add rigidbodies to Swords for collision detection. They must be $$anonymous$$inematic or strange things happen. The sword is a child of the Character's hand.
Thanks for giving me the rules with parenting and rigidbody.
meat: theOP isn't using a joint/hinge component. $$anonymous$$erely using the word "hinge" descriptively. Even so, I'm thinking the default setting on hinges is to never break. They seem to just deform under pressure.
I guess I'm not sure what the OP is trying to accomplish. Looks-wise, a kinematic rigidbody child is the exact same thing as not being a rigidbody at all -- just frozen to the parent. I assumed the OP added the rigidbody to the weapon to get some "play" in it, or have it jostle a bit. But not really sure.
Completely missed that. Thanks for pointing it out. Ill omit the irrelevant line :)
Your answer
Follow this Question
Related Questions
Shooting a cannonball. 6 Answers
Direction of rotation and ApplyForce 1 Answer
Rotation Force on a model 2 Answers
Attaching multiple rigidbodies together and spawnning as prefabs 1 Answer