const engine = bitbybit.babylon.engine.getEngine();
const scene = new BABYLON.Scene(engine);
bitbybit.babylon.scene.setAndAttachScene({ scene });
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(100, 30, -100), scene);
camera.setTarget(new BABYLON.Vector3(0, 5, 0));
const canvas = bitbybit.babylon.engine.getRenderingCanvas();
camera.attachControl(canvas, true);
camera.speed = 1;
camera.minZ = 0;
const light = new BABYLON.HemisphericLight("HemiLight", new BABYLON.Vector3(0, 1, 0), scene);
light.intensityMode = BABYLON.Light.INTENSITYMODE_ILLUMINANCE;
light.intensity = 1;
const start = async () => {
const birdhouseOptions = new Bit.Things.KidsCorner.BirdHouses.ChirpyChalet.ChirpyChaletDto();
const birdhouse = await bitbybit.things.kidsCorner.birdhouses.chirpyChalet.create(birdhouseOptions);
const mesh = await bitbybit.draw.drawAnyAsync({
entity: birdhouse
});
for (let x = -100; x < 100; x += 10) {
for (let z = -100; z < 100; z += 10) {
const allChildren = mesh.getChildMeshes();
allChildren.forEach((c: BABYLON.Mesh) => {
const instancedMesh = c.createInstance(`${x}-${z}`);
instancedMesh.position = new BABYLON.Vector3(x, 0, z);
})
}
}
}
start();