How would I approach this?

Godot Version

Godot 4

Question

How would i approach this?

so i have 2 objects: obj1 and obj2 (there is 1 obj1 but can be more and there is more than 1 obj2) so i want any obj1’s to detect if there is any obj2’s and store them in an array then it will get the first value of the array and parse it somehow so i can use it to for example make obj1 move towards obj2

If the objects are Nodes you can assign the obj2 to groups and use this function

var obj2s = get_tree().get_nodes_in_group("obj2")
1 Like