0 votes

Hello,
I'm trying to detect collision between different objects that are not under the same parent but failed to achieve what I want.

note scene
here is a scene for Note. this scene is simply and image with an Area2D and a collision shape to detect collision.

Here is the main scene
this is the main scene with a lot of control nodes. But here two are particularly important.
The Note node which is of type RigidBody2D is supposed to slide down with a constant speed toward the bottom. This node doesn't need detection collision yet. it will contain multiple note scenes and make all this "note" slide down with the body.
there is also and Area2D with a collisionShape2D. this one is fixed and doesn't move.

My problem is that Notes are sliding down because they are parents to the RigidBody? but once they reach the bottom and should detect collision with the static Area2D nothing happened.

what should I do to make it work ? is nested collision impossible with godot? is detection collision incompatible with Control node?

in Engine by (15 points)

Firstly your rigidbody has no CollisionShape child node. Secondly "is detection collision incompatible with Control node?" Yes but the rigidbody must be the parent. Thirdly what are the scripts doing? Are they just signals or are they also controlling movement?

Thank you for your response.

rigidbody has no CollisionShape child node.

Yes, I made it so because I do not need this rigid-body to detect collisions. I just use to make all its children slide down at a constant velocity. It's the children of this rigid
body I want to detect.

Yes but the rigidbody must be the parent

I changed the control and made it only with Area2D instead of using the control node. now it seems to work. But I have some trouble when instancing the node. I guess I have to rewrite the behavior of the "note"

what are the scripts doing?

Right now nothing it's just signaling. I want to detect when a "note" hit the bottom of the screen via the built-in collision detection of godot. I use Area_entered() since I work with Area2D.

The Control node script will have to extend Area2D and cannot use Control methods or properties unless you reference a control node before hand.
Also regarding the RigidBody, the children will need a CollisionShape as their parent however when detected the entire RigidBody is detected not just the CollisionShape children. They will all need RigidBodies to each be detected.

Thank you very much,

Now it is working. I needed to make the children of the Rigid body Area2D.
Now collisions are being detected as expected.

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.