Files
Leenkx_Examples/script_spawnobject/Sources/lnx/SpawnTrait.hx
2026-05-06 17:52:45 -07:00

24 lines
617 B
Haxe

package lnx;
class SpawnTrait extends iron.Trait {
public function new() {
super();
notifyOnInit(function() {
// Spawn object from scene hierarchy, including children
iron.Scene.active.spawnObject("Cube", null, function(object:iron.object.Object) {
object.transform.loc.set(0, 4, 0);
object.transform.buildMatrix();
});
// Spawn single object from scene hierarchy
var spawnChildren = false;
iron.Scene.active.spawnObject("Cube", null, function(object:iron.object.Object) {
object.transform.loc.set(-4, 0, 0);
object.transform.buildMatrix();
}, spawnChildren);
});
}
}