Im currently using Godot 4 to make my 3D platformer to practice Scripting, I am fairly new and found a tutorial in youtube which teaches you how to Teleport your player. it said that add "if area.is_in_group("group_name")"
to check if it the area it collides with has a specific group. but when i tried it in godot 4, there was a warning that said something about that area is not a parameter. anyone knows how i can fix this?
How to detect area groups in Godot 4
is_in_group
doesn't check for collisions, groups can include any type of node regardless of whether they're even capable of collisiding. My guess is that in the tutorial that line of code showed up after the collision was detected, and was a check to see whether the area the player collided with was a teleporter.
- Edited
To check for a specific group collision in an Area you can make use of signals.
Connect the signal to the appropriate code then use the body variable in the signal code given to you to check, in this case you'll probably want one containing a body if you wonder what to pick.
if body.is_in_group("ExampleGroup"):
# Insert code you want to execute here
pesudo code example.