A Basic House
import { ArcRotateCamera, HemisphericLight, MeshBuilder, Scene, Sound, Vector3 } from "@babylonjs/core"
import { createApp } from "../utils"
const app = createApp((canvas, engine) => {
const scene = new Scene(engine)
const camera = new ArcRotateCamera("camera", -Math.PI/2, Math.PI/2.5, 15, Vector3.Zero(), scene)
camera.attachControl(canvas, true)
const light = new HemisphericLight('light', new Vector3(1, 1, 0), scene)
// customize your scene here
const ground = MeshBuilder.CreateGround("ground", {width: 10, height: 10}, scene)
const box = MeshBuilder.CreateBox("box", {width: 1, height: 1, depth: 1}, scene)
box.position.y = 0.5
const roof = MeshBuilder.CreateCylinder("roof", {height: 1.2, diameter: 1.3, tessellation: 3}, scene)
roof.scaling.x = 0.75
roof.rotation.z = Math.PI / 2
roof.position.y = 1.22
return scene
})
app.run()
Creating Set Shapes
Common 3D Shapes
const mesh = BABYLON.MeshBuilder.Create<MeshType>(name, options, scene)
const myLines = BABYLON.MeshBuilder.CreateLines("lines", {points: myPoints});
myPoints[1] = new BABYLON.Vector3(1, 2, 3);
myLines = BABYLON.MeshBuilder.CreateLines("lines", {points: myArray, instance: myLines});