How to add several collision detections to the player

Hey there! im working on a game about landing rockets and i want to have different collision shapes for the body and the legs of the rocket, to detect when the player is touching the landing platform with the legs of the ship or the body.
but right now this detection system works on the rigidbodys signal body_entered , i tried to add area node but its signal is area_entered and it dosnt detect the world .
how can i use another body_entered signal for the legs of the ship ?
unity refuge crying for help T-T

Show how your node tree is set up. You can probably just add more RigidBody parts to represent the legs.

1 Like

Any collision shape that’s a child node of the RigidBody node should trigger the body_entered signal as far as I’m aware.
I made a casual game where my RigidBody had 3 CollisionShape3D’s as child nodes, and it worked just fine.

1 Like

i guess i can its just that im a unity refuge so godot confuses me a bit
ive tried to add another collision shape but the signal is goes from the rigidbody, how can i detect which collision shape was triggered ?

As far as I know, you can’t can’t detect which collision shape collided of you have multiple collision shapes under a physics body. There are a couple of options you can explore to know which part of the rocket collided:

  1. Setup the rocket parts as different physics bodies in their own scene and have a master scene where you arrange them together under a node. This will mean you have to code your own physics though.

  2. Add areas to the different parts of the rocket and setup the right collision layers to detect which part os currently colliding with the world.

  3. With your current setup, when the ship collide with the world, shoot raycasts in different directions to approximate which part of the ship is colliding with the world. You can preset this raycasts at certain parts of the ship in your scene and loop through them to check which one is colliding.

You can also combine a couple of these ideas for better precision.

1 Like

Instead of the root being the RigidBody, make it a regular Node3D, then have a series of RigidBody nodes inside. If you want you can have one main RigidBody with multiple RigidBody descendants. Then give each one the appropriate collision shape. You may need to use a Joint to keep them together. This way you will get the ability to know which part made contact while retaining the control over the entire structure. You could even use different joints if you want to let them break under certain conditions, but you’d have to make that part on your own.

1 Like

tnx for the tips , raycasting sounds like over engineering this, creating my own physics is a bit of a far jump for my first game i think xd , and i wanna try avoid areas for continuity and to learn bodys

well that souds like a rally nice solution and the mechanics i want to add should build up on it pretty nicely !
ill search for a tut on those joints and ill try to implement it .
Thanks mate !!

1 Like