get_groups() / is_in_group() not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Naumen0

Hi. Here’s the code:

for index in range(get_slide_count()):
    var collision = get_slide_collision(index)
    var object = collision.collider
    print(object.get_groups())

get_groups() method returns only empty arrays even though colliders are in groups. The problem is that collision.collider returns Object that doesn’t have get_groups() method but Node does. I tried adding as Node to the variable but it didn’t help. What should I do?

Note: yet somehow similar code works in “your first 3D game” demo

Are you sure the collider is the object/node that you think it is?

SteveSmith | 2023-01-13 10:54

I suppose as it inherits from Node

Naumen0 | 2023-01-13 16:18

:bust_in_silhouette: Reply From: Naumen0

Nevermind I solved it :'D