Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+12 votes

I recently added a new projectile (an Area2D) to my game, but it doesn't interact with anything. I have it set to the correct Collision layer, and I have it in the same group as the other enemy projectiles. Is there some other property that I might be missing?

asked in CSC380Jan2024 by (1 point)

4 Answers

+3 votes
 
Best answer

Does it have the correct masking for the interactions? Did you set a custom class for the other projectiles that you need to set for this new projectile? Oh! And did you set up the signals correctly? That's a big one.

answered by (1 point)
selected by
+2

This was it. I forgot to connect the signal of the new projectile body entered to the general projectile script. Thank you!

+2

It's always the signals!

+3 votes

you set the correct collission mask as well? otherwise it won't look for the right things

answered by (1 point)
+3 votes

Later and mask settings need to be checked, make sure you have a node hooked up to the script to handle collision, if you have one double check it’s hooked up, make sure both parties in the collision have those, make sure that your collision script actually causes an effect on collision, etc.

answered by (1 point)
+2

The collision layers should overlap, however the way I did this was with groups and signals. Depending on the type of projectile, area or body, on the areas signal you need to connect and on_area_entered or on_body_entered signal to your script. Once in the script, check the group that the projectile is in by doing the ... if area.is_in_group(""): and write your code there

0 votes

Verify the collision layer and mask settings to ensure they match with the layers of objects it should interact with. Also, check that signals like area_entered are correctly connected

answered by (1 point)
...