Is there a better method or way to generate multiple objects that are the same ?
so here is what i have so far and im just curious is there a better way?
one that impacts performance less
_LoadClouds() {
for (let i = 0; i < 10; ++i) {
const index = math.rand_int(1, 3);
const pos = new THREE.Vector3(
(Math.random() * 2.0 - 1.0) * 800,
400 + (Math.random() * 2.0 - 1.0) * 100,
(Math.random() * 2.0 - 1.0) * 860);
const e = new entity.Entity();
e.AddComponent(new gltf_component.StaticModelComponent({
scene: this._scene,
resourcePath: './resources/nature2/GLTF/',
resourceName: 'Cloud' + index + '.glb',
position: pos,
scale: Math.random() * 5 + 10,
emissive: new THREE.Color(0x808080),
}));
e.SetPosition(pos);
this._entityManager.Add(e);
e.SetActive(false);
}
}
thanks for reading