Godot Version
v4.3.stable.arch_linux
Question
I’m trying to remake and old project of mine now in godot, to learn the basics.
What i’m trying to achieve is a modular character (in this case a tank) where different parts of the body are separate scenes and are then placed into the actual CharacterBody3D
scene. (In this case I would like to separate the Turret and the Base of the tank.)
The reasoning behind this is that for instance I would like to have the turret responsible for the “shoot” function. That way I could create different versions of turrets with different abilities and easily swap them out to create new enemies, or player vehicles.
The problems now are the following:
No Collision Mesh Set
If I strucure the Tank
as
- Tank (CharacterBody3D)
-- TankBase (StaticBody3D)
-- TankTurret (StaticBody3D)
- TankBase (StaticBody3D)
-- BaseMesh (MeshInstance3D)
-- BaseCollision (CollisionShape3D)
- TankTurret (Same Structure as Tank Base)
then the Tank
node has no collision mesh set and thus falls through the floor.
Is there a way to tell Tank
To use the collision shapes of its children?
At the moment it seems like there is no way of doing this.
Children Colliding with Parents
When I tried to instead make this non-modular (allthough I realy want the modularity of having different parts be their own scenes ) and used the same structure as above with the addition of a CollisionShape3D
node in Tank
, then it suddenly started to fly or fall through the floor.
The reason for this, as i found out is that the Tank
collision mesh is colliding with it’s identical counterpart in TankBase
.
After setting this to a different collision layer, everything worked. But this tells me that there must be some way for Tank
to find and use the collision shapes of its children as its own.
I hope this wasn’t to much of an overload.
Is the behavior i’m seeking even possible, or how would one approach this design problem in Godot?
Thanks for the Help!