An array of numbers, or height values, that are spread out along the x axis.
Optional options: { Optional elementWorld spacing between the data points in X direction.
Optional maxMax value of the data points in the data array. Will be computed automatically if not given.
Optional minMinimum value of the data points in the data array. Will be computed automatically if not given.
The body to which the shape is added to.
The local bounding sphere radius of this shape.
true
1
-1
Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.
true
An array of numbers, or height values, that are spread out along the x axis.
World spacing between the data points in X and Y direction.
elementSizeX and Y
1
Identifier of the Shape.
Optional material of the shape that regulates contact properties.
Max value of the data points in the data array.
Minimum value of the data points in the data array.
The type of this shape. Must be set to an int > 0 by subclasses.
Static idStatic typesAll the Shape types.
Readonly BOX: 4BOX
Readonly COMPOUND: 8COMPOUND
Readonly CONVEXPOLYHEDRON: 16CONVEXPOLYHEDRON
Readonly CYLINDER: 128CYLINDER
Readonly HEIGHTFIELD: 32HEIGHTFIELD
Readonly PARTICLE: 64PARTICLE
Readonly PLANE: 2PLANE
Readonly SPHERE: 1SPHERE
Readonly TRIMESH: 256TRIMESH
use abstract for these kind of methods
Get an AABB of a square in the heightfield
Get the index of a local position on the heightfield. The indexes indicate the rectangles, so if your terrain is made of N x N height data points, you will have rectangle indexes ranging from 0 to N-1.
Two-element array
If the position should be clamped to the heightfield edge.
Get max/min in a rectangle in the matrix data
Optional result: number[]An array to store the results in.
The result array, if it was passed in. Minimum will be at position 0 and max at 1.
Sets the height values from an image. Currently only supported in browser.
Heightfield shape class. Height data is given as an array. These data points are spread out evenly with a given distance.
Todo
Should be possible to use along all axes, not just y
Todo
should be possible to scale along all axes
Todo
Refactor elementSize to elementSizeX and elementSizeY
Example