Skip to main content

Function: addTerrainMeshComponent()

addTerrainMeshComponent(world, entity, options): TerrainMeshEcsComponent

Defined in: rendering/terrain/components/terrain-mesh-component.ts:55

Attaches a TerrainMeshEcsComponent to entity, so createTerrainRenderEcsSystem draws its mesh every frame. A world can have any number of entities with this component - each terrain mesh is drawn independently, so multiple TerrainColliders can each have their own visualized mesh.

Parameters​

world​

EcsWorld

The ECS world entity belongs to.

entity​

number

The entity to attach the component to.

options​

TerrainMeshRequiredOptions & Partial<TerrainMeshEcsComponent>

Options for configuring the terrain mesh. mesh has no sensible default and must always be provided.

Returns​

TerrainMeshEcsComponent

The attached component, for further tuning or runtime changes.