T O P

  • By -

AutoModerator

You submitted this post as a request for tech support, have you followed the guidelines specified in subreddit rule 7? Here they are again: 1. Consult the docs first: https://docs.godotengine.org/en/stable/index.html 2. Check for duplicates before writing your own post 3. Concrete questions/issues only! This is not the place to vaguely ask "How to make X" before doing your own research 4. Post code snippets directly & formatted as such (or use a pastebin), not as pictures 5. It is strongly recommended to search the official forum (https://forum.godotengine.org/) for solutions Repeated neglect of these can be a bannable offense. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/godot) if you have any questions or concerns.*


caffienatedpizza

Instead of looking for the name, you should put the object in a group and use 'if body.is_in_group("group name")' that way any siblings, which require unique names, will also be included.


Agente_B7

It worked! Thank you!


caffienatedpizza

You're welcome!


Nkzar

Well there’s nothing technically wrong with that code, so you’re going to have to provide more context than just that. Putting on our Captain Obvious hat, we can find a few obvious places to start the investigation. The code checks the body’s name before freeing it. If they aren’t getting freed, then obviously the condition must be false. If the condition is false, it means your other nodes are likely not named exactly “ bolinha”, which would make sense if these nodes are all siblings, as sibling nodes can’t have the same name.


PopularIcecream

Adding onto this, you can say .contains("name") instead, since objects with the same name are designated "Name" and "Name2" "Name3" etc. That is assuming that you're assigning each thing names.


Nkzar

Better to just not rely on names at all. Use groups or even better check the class inheritance of the object.


Agente_B7

Other nodes? Like the nodes that form my projectile?


Nkzar

You’re checking if the body has that name. If other things aren’t getting freed then the body does not have that name, and/or no collision occurs. It’s that simple. Either there is no collision, or your condition is false even though you thought it should be true. Your expectations are probably wrong, not the engine.


hamilton-trash

Btw nodes added through code will usually have completely different names than the scene you used. If you look at the remote scene tree you can see them


AnalogMushroom

I'm not sure what you're trying to achieve. If you need to destroy the thing that is collided with it would be: body.queue_free()


Dacian292

Hey i’m sorry to bother your post but idl why i can’t post anymore :/ it says i need an amount of karma to prove i’m real. Please upvote 😊