Renderer · class

RainField

Explained in Hello world.

class RainField
import { RainField } from '@driftengine/core';

Constructor

new

constructor(options: RainFieldOptions)
ParameterTypeDescription
optionsRainFieldOptions

Properties

NameTypeDescription
segmentsreadonlyLineSegments
speedMpsnumberFall speed, metres a second. Rain is about 9, drizzle 2, hail 14.
streakSecnumberThe shutter time the streak shows, seconds: 0.02 is a crisp dash, 0.1 a long exposure.
More

It changes how long a drop looks and never where it is, so a downpour can smear without falling any faster.

Accessors

NameTypeDescription
shelteredCountgetnumberDrops that were over the viewer's head and under something else, last update.

Methods

update

update(dt: number, viewerX: number, viewerY: number, viewerZ: number, windX?: number, windZ?: number): void

Fall for dt, then rebuild the streaks around a viewer.

ParameterTypeDescription
dtnumber
viewerXnumber
viewerYnumber
viewerZnumber
windX?number
windZ?number
More

windX and windZ are metres per second sideways, and the same numbers the rest of the scene is answering to: rain leaning one way while the smoke beside it leans another is the failure this parameter exists to prevent, and it is why the wind is passed in rather than owned here.