- Home /
2D: Should attaching a child object affect the parent object's mass? Please help.
Hi, I'm in desperate need of some help. I'm putting together a 2d car game and I've set up some AI controlled vehicles which I was happy with. Each Rigidbody 2D was fine - mass, drag etc. and the cars were behaving exactly as I wanted.
Then i decided to attach a child object to the back of vehicle - a jet sprite with an Animator - and that's when thing started to go wrong.
With the child object attached the cars began misbehaving. They failed to rotate properly and became "floaty" as if their mass or gravity had changed. Not a problem, I thought, I'll delete the child object and try again. But even with the object deleted and any script work undone the cars will not revert to their original behaviour. I'm tearing what's left of my hair out here.
Has anyone encountered anything similar and, if so, can you offer some advice?
Thanks,
Suminell.
This answer might be a bit annoying but have you tried restarting Unity or even your machine with the code and components that worked for you? I've experienced weird behavior like this before and after restart it went away.
Thanks for the reply. Yes, I'd tried that and it wasn't helping. I have, however found what was causing my problem...
Somehow during the process of attaching the child object the parent object's Polygon Collider 2D component had become corrupted - it said it had zero vertices when it should have had 10. I was able to copy component values from a backup object and that resolved my issue and the cars are back working as they were before.
Thanks,
Su$$anonymous$$ell.
Your answer

Follow this Question
Related Questions
Can I arbitrarily move a dynamic Rigidbody 2D? 1 Answer
How do I make a child RigidBody be stuck to a parent RigidBody (Unity2D) 1 Answer
Possible to use child OnCollisionEnter with parent Rigidbody object? 1 Answer
RigidbobyConstraints2D is not working in Unity 5.0.2f1 Personal Edition!! 0 Answers
Is it possible to swap my x Axis and y Axis on a rigidbody2D? 1 Answer