Prefabs

Grass

Interactive grass prefab with entity-based deformation.

The Grass prefab renders an interactive grass field. Entities that implement GrassAffectingEntity will cause the grass to react to their presence (e.g. bend/part as a character walks through).

Usage

import { Grass } from '@mavonengine/core'

const grass = new Grass()
game.world.add({ grass })

GrassAffectingEntity

Implement this interface on any entity that should interact with the grass:

import type { GrassAffectingEntity } from '@mavonengine/core'

class MyPlayer extends Entity3D implements GrassAffectingEntity {
  // The grass system will read this entity's position
  // to compute deformation
}

Configuration

Configuration options for the grass (density, scale, wind, color) are available on the Grass instance. Refer to the source for the full list of options.