Creating A Ground
Ground
A ground is a flat, horizontal plane parallel to the xz plane that can be subdivided into rectangular regions. The origin of the ground is at the center of the plane. The optional properties that determine the size of the ground are width (x) and height (z) (and yes, we all agree that depth would be more descriptive than height!).
MeshBuilder
Usage :
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";const ground = MeshBuilder.CreateGround("ground", options, scene); //scene is optional and defaults to the current scene| option | value | default value |
|---|---|---|
| width | (number) size of the width | 1 |
| height | (number) size of the height | 1 |
| updatable | (boolean) true if the mesh is updatable | false |
| subdivisions | (number) number of square subdivisions along each axis | 1 |
Example
Mesh
Usage
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";const ground = MeshBuilder.CreateGround("ground", { width, height, subdivisions }, scene);const ground = MeshBuilder.CreateGround("ground", { width, height, subdivisions }, scene, updatable); //one optional parameter after scene