Hello! I want to get an object. Its not a child of an object. There is a “Get Child” function but my question is: How can I get a simple Object in Haxe?!
Hi, I see you didn’t specify with what property you wanted to find the object with, but a way to find an object through their name is (it’s with getChild but over the scene, idk if that you wanted to avoid),
import iron.Scene; .... var anObject = Scene.active.getChild("object name"); if (anObject != null) trace("success! object pos: " + anObject.transform.world.getLoc());
you can also find a Collection instead of an object, by the collection name:
import iron.Scene; .... var aGroupOfObjects = Scene.active.getGroup("object collection"); if (aGroupOfObjects != null) trace("success! Objects: " + aGroupOfObjects.length);
Omg I am so dumb! I already thought about that but didn’t try it out. Thank you so much!!
Hi, I created an entry in the wiki and a PR to add a new script example in /armory_examples to showcase how to use the functions and how to manually search objects in the scene that meet certain condition with recursion.
Feel free to test the functions I added, I did a few test just to be sure they work correctly but maybe I overlooked something.