Getting Started - Chapter 6 - A Lathe Turned Fountain
A Lathe Turned Fountain
Time to introduce another of the many ways to create a mesh: the CreateLathe method. We start with a profile for the fountain.

The profile is described, in an array, using the x and y components of a 3D vector.
import { Vector3 } from "@babylonjs/core/Maths/math.vector";const fountainProfile = [ new Vector3(0, 0, 0), new Vector3(10, 0, 0), new Vector3(10, 4, 0), new Vector3(8, 4, 0), new Vector3(8, 1, 0), new Vector3(1, 2, 0), new Vector3(1, 15, 0), new Vector3(3, 17, 0)];The array is used in the shape property of the options parameter in the CreateLathe method.
import { Mesh } from "@babylonjs/core/Meshes/mesh";import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";const fountain = MeshBuilder.CreateLathe("fountain", { shape: fountainProfile, sideOrientation: Mesh.DOUBLESIDE }, scene);As before, the scene parameter is optional. In this case, the mesh is set to double-sided because the inside is visible due to the slope at the top and the hollow middle.
Basic Lathe FountainWith appropriate scaling and positioning, this is added to the village.
Add the FountainA fountain without a spray of water is a little boring, so we simulate the spray with particles.