How to set up a modular character with collision being defined in the child nodes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Swampi

I am currently developing a small 2d space game for learning godot.
I want to have “modular” ships, meaning a ship has a hull, an engine, cannons, etc. each being a scene.
A ship could be set up like this

|- Hull
|- Engine

Now I am stuck with the following problem. I set up the Ship node as KinematicBody2D as I use that node for movement.
BUT the collision should come from the sub scenes (Hull, Engine, etc.).
So I made them KinematicBodies too and added the CollisionShapes.

However this does not work, as the Ship needs a CollisionShape child (KinematicBody2D) and it being in the nested Scenes (Hull, Engine, etc.) does not suffice. In addition if I move the Ship node with move_and_collide/_slide the child nodes do not collide.

I do not think that my current approach is correct.
What can I do to accomplish this without breaking my modularity by moving the children collisions to the Ship?

:bust_in_silhouette: Reply From: Zaknhrae

I know this question is old, I had the same question until yesterday and found a solution, so here it is for anyone who still have this issue creating modular scenes:

In the Ship Kinematicbody create one CollisionShape for every ship module (you can add it through code if you wish) and through coding make each of the CollisionShapes you created for each module get the extents transforms (collisionshape.shape.extents.transform) from the CollisionShape present in the respectives module scenes (you will just use them to get the shapes you set, no need for the modules to be physics body as you only need the data from the collision extents).