How to get CollisionPolygon2D sibling on each frame?

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

It could be any method you can think of. Is there a way to get CollisionPolygon2D sibling on each frame?

:bust_in_silhouette: Reply From: jgodfrey

You didn’t provide much to go on but, generally speaking, you can get sibling nodes
of the current node using something like this:

var children = get_parent().get_children()

Note, that collection will also include the current node (as it’s also a child of its parent).

Regarding doing it every frame - you could just place the code in _update(), though is that really what you want to do?

Perhaps a more detailed explanation of your goal would be helpful.

I was trying to animate CollisionPolygon2D coupled with sprite animation. I did think of a way, but the process was kinda long and it was kind of pain.

DunnoBruno | 2022-04-15 19:39