update
This commit is contained in:
23
script_spawnobject/Sources/lnx/SpawnTrait.hx
Normal file
23
script_spawnobject/Sources/lnx/SpawnTrait.hx
Normal file
@ -0,0 +1,23 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user