HeightFieldShape3D class final

Terrain: a square grid of heights. Static bodies only.

heights holds sampleCount rows of sampleCount samples; sample heights[row * sampleCount + column] is how far up (towards −Y, the engine's up) the ground is at x = column × cellSize, z = row × cellSize in the body's space. The grid starts at the body's origin and runs towards +X and +Z. A sample of hole or more is a hole: the cells round it are not there, and things fall through.

Inheritance

Constructors

HeightFieldShape3D(Float32List heights, int sampleCount, double cellSize)
A terrain of sampleCount × sampleCount heights, cellSize metres apart.
const

Properties

cellSize → double
Distance between neighbouring samples.
final
hashCode → int
The hash code for this object.
no setteroverride
heights → Float32List
Row-major heights, sampleCount squared of them.
final
isValid → bool
Whether this shape is well formed: every size finite and above zero, a hull of at least 4 points, a mesh of at least one triangle whose indices are all in its vertex list, a height field of at least 4 × 4 samples, a compound of at least one part, every number finite, a rotation of some length. A body of a shape that is not is never made (createBody returns 0) and a query with one finds nothing, on every backend. A backend can still refuse a well-formed shape it cannot build — Jolt a hull whose points are all on one plane, or a mesh of only degenerate triangles — so check what createBody returns.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sampleCount → int
Samples along each side; at least 4.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

hole → const double
A height that marks a hole.