new to godot, and having a bit of trouble

so I have the RB2D collision layer just for collisions, and I have a area2d collision layer for detecting contact between cloned nodes, but it doesnt detect the two earth nodes touching unless I set the area2D collision mask to layer 1 and I'm not sure why.

37 points · 4 comments · view on lemmy.world

4 Comments

popcar2@programming.dev · 8 pts · 1y (3 replies)

Sounds like you misconfigured your layers and masks. The collision mask determines which layers it can touch, so it sounds like you have the earth Rigidbody on layer 1 and are trying to detect the body.

BilliamBoberts@lemmy.world · 4 pts · 1y (2 replies)

I want the RB2D on layer 1 so it collides with other bodies but I want some way to detect when it has collided with a clone of the area2d so I put area2D on layer 2. is there a better way to detect cloned nodes?

popcar2@programming.dev · 7 pts · 1y (1 reply)

You can create a Group for the planet then check in your code if that's what the area is touching. Ex: if body.is_in_group("planet"): #do something

BilliamBoberts@lemmy.world · 2 pts · 1y

that worked. thanks so much!