Godot Version
4.7.stable
Question
Im attempting to test wether or not the object that enters this Area3D is apart of the group boxes but when i add something that is apart of that group it prints out []
ive put every partof the box being added into the group and yet nothing
this first if statement works fine but when we get to the body.is_in_group() if statement is when we get problems
func _on_area_3d_body_entered(body: Node3D) -> void:
if not truck.boxesInTruck.has(self):
return
print(body.get_groups())
if body.is_in_group("boxes"):
boxesLeft -= 1
CountDownTimer += 1
GivenAbility = "Timer " + str(CountDownTimer) + ": Place " + str(boxesLeft) + " Units next to this one"
if you need the full script please let me know. Nothing else really changes this part other then in ready() which i have add_to_group(“boxes”)
Put a print statement inside if body... block
ive tried, it doesn’t print anything
Does the Area3D detect anything at all? I’d add a print(“area entered test”) at the start, to test if its collision is working and the signals are set up right.
If that empty array is printed by print(body.get_groups()), then the body that entered is not in any group.
We can see in the first screenshots he’s enabled a group on all of the nodes in baseBox, even ones that don’t need it, so if this is the case then he’s accidentally dropped the wrong scene into the test.
Yeah, there’s likely a problem somewhere in the setup.
Btw @shinomations, a small hint, when printing values of the variables, also print what you’re printing.
So instead of just doing print(foo), do print("foo = ", foo)
Otherwise you might get confused when printing multiple things which will typically be the case.
yes it does, i created a print(body.get_group()) and it printed everytime i added a box to it but the only thing that would be printed was “[ ]”
there is no problem in the setup, i have spawn points that are Node3D that all have boxes also enabled by default
Figured it out: Turn out that one of my other programmers had added a remove_from_group(“boxes”)