![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
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
Ship
|- 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?