Three-only: a 3D scene
Create a cube and a camera in JSON.
For a 3D game without a Pixi UI, select ThreeRendererModule from @gamedevland/engine/renderers/three. Install the library with npm install three and the types with npm install --save-dev @types/three. This mode does not need PixiJS.
Set system.renderer: new ThreeRendererModule() in GameConfig. In the scene layout, create a cube and a camera:
{
"world": {
"type": "Group",
"children": {
"cube": {
"type": "Mesh",
"props": {
"geometry": { "type": "box" },
"material": { "type": "basic", "color": "#40aacc" }
}
},
"camera": {
"type": "PerspectiveCamera",
"props": {
"position": { "x": 0, "y": 2, "z": 5 },
"lookAt": { "x": 0, "y": 0, "z": 0 },
"near": 0.1, "far": 100, "fov": 50
}
}
}
}
}
Set SceneConfig.render to { camera: 'world.camera' }. The basic material displays its color without lighting; add a light for a standard material.
Position and scale use { x, y, z } vectors; rotations use radians. Y points up, the ground lies in XZ, and distances use meters. Only Group accepts authored child nodes in JSON.
A component declares nodeType = ThreeNode or ThreeGroup and changes the object through this.node.view. node.input finds the nearest visible interactive node by casting a ray from the camera. Hitting part of a GLB resolves to its owning Model node.