How to create compound rigidbodies?

I would like to reach the effect of for example putting/spawning a stone on the back of a truck. I'd like to behave it realistically. Searched almost everywhere, couldn't find an answer... Parenting two rigidbodies or turning ON isKinematic on the child doesn't do the trick. I also can't use altering the transforms, nor MovePosition. I really hope there's a reasonable solution out there somewhere.. Pleeease helppp!

Did you consider reading the documentation on physics or rigidbodies? They clearly state:

You should never have a parent and child rigidbody together

Consider what you want to do. You have a rock on the back of a truck, but what keeps the rock on the back of the truck? Friction which cannot exist without the forces of gravity, the materials' surfaces' effect on friction, and collision.

  • Without the force of gravity pulling your rock down onto your truck bed, there would be no collision and no friction. When your truck moves, the rock would just float there without any forces acting upon it. Note that gravity is dependent upon mass.
  • With a material that has little to no friction (like ice), even with gravity, your rock will just slide right off.
  • Even with friction and gravity, unless your object is of an extreme density and/or your fiction is to the point of being glued down, rocks won't sit in the truck for long, hence all the rock chips in peoples' windshields. Depending on your setup, you may need something to hold the object on the truck, be it the tailgate or some straps in case it slides around.

What does this mean? To behave somewhat realistically:

  • Your rock rigidbody needs gravity and the mass should be set appropriately.
  • Add approrpiate physic materials to your colliders
  • Ensure that your colliders and the rest of your scene are setup correctly.

There are all sorts of things that aren't properly emulated within physics simulation, like aerodynamics and buoyancy for example so it will never be perfectly realistic.

If you don't care how the rock behaves once it is in the truck, you could always add code to remove the rigidbody and parent the truck to the rock OnCollision if you like.

@Gil the short answer I believe is that the way to go about what you want to do is to:

a) Increase the mass of the truck object itself each time an object is added
b) Change the centre of mass of the truck (including rocks) by hand to account for the new weight distribution

Part b will require understanding centre of mass calculations for discreet objects, see centre of mass for particles here Center of Mass

Might be confusing if you’re not familiar with physics concepts but Physx doesn’t have any way to ‘weld’ or compound rigidbodies together in a way that preserves their respective mass distributions to my knowledge…