Moving rigid body objects inside another rigid body object (like a box)
This is my first question on here, so hopefully it doesn't offed your senses.
I have a moving train that has box on it, inside the box are grenades, so I have the following problems:
if I make the grenades children of the box, they stay inside fine and move with the train (5 rigid body cubes + box colliders form the box itself - they are set as kinematic so it doesn't go flying off the train), however when you pick them up and throw them off the train, they're following the train's physics, not the world
If I instantiate the grenades inside the world space in the box, then they fly out immediately as if they don't ever collide with the box
Of course, if I make the box itself Static, it stays in space and won't move with the train
I have tried making the rigid body of the box and grenades Continuous Dynamic, but that doesn't seem to help either.
Any pointers would be amazing.
Answer by azinicus · Jul 13, 2016 at 09:20 PM
Ok so this is a much more complex issue than I anticipated... basically, don't transform the parent of something that should have natural physics in relation to the rest of the world. By transforming the train, essentially the physics of all child objects gets skewed very unnaturally. The solution is to apply force to the train to make it move and calculate physics appropriately... which is a whole can of worms by itself.