I have a Player made up of several KinematicBody2D
nodes. The Player is supposed to have several customizable parts.
- Each part is its own scene with
KinematicBody2D
as root
.
- Each part also have its own
AnimatedSprite
and CollisionShape2D
ect..
Here is how the tree looks :
Player (KinematicBody2D)
|--- Part1 (KinematicBody2D)
| |----Part1_CollisonShape
|
|--- Part2 (KinematicBody2D)
|----Part2_CollisonShape
I am composing the Player with these parts (using add_child(part)
in code). Player Itself is a KinematicBody2D
with a Camera2D
and VisiblityNotifier2D
as its children. As KinematicBody2D
needs to have a CollisionShape2D
, I have a added a small dummy shape to the Player.
When I move the Player with move_and_slide()
, only the direct CollisionShape2D
children of the Player seems to have an effect. CollisionShape2D
from the parts interact with other physics objects but have no effect during move_and_slide()
.
What i want is for all CollisionShape2D
children, direct and from the Parts to be considered in move_and_slide()
calculations. Is there any way ?
I can work around this by adding a copy of Part's collision shape to the Player in code but I think where should be a better way.