update
This commit is contained in:
3
spawn_from_scene/README.md
Normal file
3
spawn_from_scene/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
Spawns an object from another scene.
|
||||
|
||||
https://api.leenkx3d.org/iron/Scene.html#spawnObject
|
||||
22
spawn_from_scene/Sources/lnx/MyTrait.hx
Normal file
22
spawn_from_scene/Sources/lnx/MyTrait.hx
Normal file
@ -0,0 +1,22 @@
|
||||
package lnx;
|
||||
|
||||
import iron.Scene;
|
||||
import iron.object.Object;
|
||||
import iron.data.Data;
|
||||
import iron.data.SceneFormat;
|
||||
|
||||
class MyTrait extends iron.Trait {
|
||||
public function new() {
|
||||
super();
|
||||
notifyOnInit(init);
|
||||
}
|
||||
|
||||
function init() {
|
||||
Data.getSceneRaw("Scene.001", function (raw:TSceneFormat) {
|
||||
var obj = Scene.getRawObjectByName(raw, "Suzanne");
|
||||
Scene.active.createObject(obj, raw, null, null, function(o:Object) {
|
||||
trace("Suzanne spawned!");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
BIN
spawn_from_scene/spawn_from_scene.blend
Normal file
BIN
spawn_from_scene/spawn_from_scene.blend
Normal file
Binary file not shown.
Reference in New Issue
Block a user