Meshes define the 3D objects in your scene. They can be loaded from various file formats or you can also generate primitive shapes (cubes, planes, cylinders, …) directly using the respective prefab types. Since meshes drive from the TransformNode class, they can be positioned and support a parent-child hierarchy as well. To configure how a mesh should be rendered, you will want to assign a material to it. This can by done by referencing a globally defined one by its name or by defining one inline.

  • Node (abstract)

    • TransformNode

      • Mesh

      • InstancedMesh

Mesh

{
    "type" : "Mesh",
    "uri" : string,
    "sourceMesh" : string,
    "material" : StandardMaterial | string,
    "isVisible" : boolean,
    "showBoundingBox" : boolean,
    "mustDepthSortFacets" : boolean,
    "renderOutline" : boolean,
    "outlineColor" : [ number, number, number ],
    "renderOverlay" : boolean,
    "overlayColor" : [ number, number, number ]
}
JSON

Either specify a uri to load meshes from files or sourceMesh to clone an existing mesh. Cloned meshes share some data like the geomtry with the source but can have differnt transformations, materials, etc.

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.mesh

InstancedMesh

{
    "type" : "InstancedMesh",
    "sourceMesh" : string,
    "position" : [ number, number, number ],
    "rotation" : [ number, number, number ],
    "scaling" : [ number, number, number ],
}
JSON

Instanced meshes share all data and properties with the source mesh except for positionrotation and scaling. This is a very efficient way of adding multipe instanced of a mesh to your scene which only differ in transformation.

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.instancedmesh

Box

{
    "type" : "BoxPrefab",
    "size" : number
}
JSON

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.meshbuilder#createbox

Cylinder

{
    "type" : "CylinderPrefab",
    "height" : number,
    "diameterTop" : number,
    "diameterBottom" : number,
    "tessellation" : number,
    "subdivisions" : number
}
JSON

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.meshbuilder#createcylinder

Plane

{
    "type" : "PlanePrefab",
    "size" : number
}
JSON

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.meshbuilder#createplane

Sphere

{
    "type" : "SpherePrefab",
    "segments" : number,
    "diameter" : number
}
JSON

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.meshbuilder#createsphere