Hello everyone!
Thanks to @sebavan and @jeff2365, I’m making progress with understanding asset containers. The community help here is awesome!
The example I’m working with is HERE.
Here are the issues:
-
Animations don’t seem to carry over to the duplicates. I tried adding new animation functions for the duplicates, but the scene crashes.
-
The duplicates can be named, but I’m not sure if it’s possible to give them unique names (for instance: box1, box2, box3). In the example, I gave the duplicates the name of “iBox1,” but that same name was applied to both duplicates.
The goal is to generate duplicates from the container template, then assign the duplicates random properties (scale, animations values, etc.).
The code below is for instances, but it seems that something similar could be applied to asset container duplicates.
for (var index = 0; index < boxNumber - 1; index++) {
let instance = box.createInstance(“box” + index);
instance.position.x = 200 - Math.random() * 400;
instance.position.z = 200 - Math.random() * 400;
instance.alwaysSelectAsActiveMesh = true;
};