I have a ship made up of :
a) Ship drive central rigidbody with single collider that handles user input and buoyancy/gravity of ship(top level parent/root).
b) Hull and barrel cages made from compound colliders with rigidbody at parent, this rigidbody is nested under the ship drive and connected to it via a config joint that locks position and limits rotation.
The ship can carry barrels. When I parent the barrels(each have a single box collider with a rigidbody) to any place within the ship hierarchy via the editor and play the game the barrels move around with the ship as expected.
When I do the same via script the barrels fly out of the ship as soon as it starts to move. Why???
I can’t link the ship drive and hull. I’m using spherical gravity and need to adjust the ship drive rotation each fixed update to align its forward/down correctly for its current position on the globe. The hull needs to flex away from this alignment to allow the barrels to fly out on impacts.
The barrels have to have rigidbody’s attached to bounce out on impacts and float on the water.
I have read that you should never nest rigidbody’s but I can’t see how to avoid it, I did try to separate the ship hull and ship drive under a centralized empty object but the ship drive orientation went nuts…
Everything works perfectly apart from the barrels parenting via scripting so any help and better explanations/links on nested rigidbody’s etc would be massively appreciated.