Script: Smart 3D Models

Smart 3D Models picture
Type
Typescript logo indicatortypescript
Author
matas
Date Created
Oct 31, 2023, 2:38:49 PM
Last Edit Date
Dec 5, 2023, 3:09:23 PM

Project Information

The course that introduces the bitbybit.dev platform to BabylonJS developers.

View Full Project

Script Code

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();
Plans & Pricing

Choose Your Plan

Editor plans for 3D development, API keys for server-side CAD algorithms

B2B

ENTERPRISE

Custom pricing

Custom software development, dedicated servers & CAD automation at scale.

CAD Automation & Software
  • Custom software development
  • Cloud CAD automation pipelines
  • 3D configurators (STEP & GLTF)
  • Batch export jobs
  • Custom algorithms & deployment
Infrastructure & Support
  • Custom compute allocation
  • Dedicated / VPS server tenants
  • Long-running computation jobs
  • Custom upload limits & overage
  • SLA & premium support