+1 vote

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.

in Engine by (13 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.