Renderer · class
TrampleField
Explained in Hello world.
class TrampleFieldimport { TrampleField } from '@driftengine/core';Constructor
new
constructor( /** * Seconds for a press to fade away completely. * * Pressed foliage fades back to its original position after a few seconds: * long enough that a trail is visible behind a character at speed, * short enough that a field does not stay combed for the rest of the run. */ recoverySec?: number)| Parameter | Type | Description |
|---|---|---|
/** * Seconds for a press to fade away completely. * * Pressed foliage fades back to its original position after a few seconds: * long enough that a trail is visible behind a character at speed | | |
* short enough that a field does not stay combed for the rest of the run. */ recoverySec?: number | |
Properties
| Name | Type | Description |
|---|---|---|
datareadonly | Float32Array<ArrayBuffer> | [x, y, z, strength] per slot; strength 0 means empty. |
Methods
press
press(x: number, y: number, z: number): voidRecord a press, or deepen the one already there.
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number |
More
Allocation-free: called every frame the character is on the ground.
update
update(frameDt: number): voidLet every press recover. Once per rendered frame.
| Parameter | Type | Description |
|---|---|---|
frameDt | number |
strengthAt
strengthAt(x: number, y: number, z: number, radiusM: number): numberHow pressed a point is, 0–1. For tests and for anything not on the GPU.
| Parameter | Type | Description |
|---|---|---|
x | number | |
y | number | |
z | number | |
radiusM | number |