Class Heightfield

A shape that is a heightfield.

Hierarchy

Constructors

  • Creates a new heightfield shape.

    Parameters

    • nrows: number

      − The number of rows in the heights matrix.

    • ncols: number

      The number of columns in the heights matrix.

    • heights: Float32Array

      The heights of the heightfield along its local y axis, provided as a matrix stored in column-major order.

    • scale: Vector

      The dimensions of the heightfield's local x,z plane.

    • Optional flags: FIX_INTERNAL_EDGES

    Returns Heightfield

Properties

Flags applied to the heightfield.

heights: Float32Array

The heights of the heightfield along its local y axis, provided as a matrix stored in column-major order.

ncols: number

The number of columns in the heights matrix.

nrows: number

The number of rows in the heights matrix.

scale: Vector

The dimensions of the heightfield's local x,z plane.

type: HeightField = ShapeType.HeightField

Methods

  • Parameters

    Returns number

  • Computes the time of impact between two moving shapes.

    Returns

    If the two moving shapes collider at some point along their trajectories, this returns the time at which the two shape collider as well as the contact information during the impact. Returns nullif the two shapes never collide along their paths.

    Parameters

    • shapePos1: Vector

      The initial position of this sahpe.

    • shapeRot1: Rotation

      The rotation of this shape.

    • shapeVel1: Vector

      The velocity of this shape.

    • shape2: Shape

      The second moving shape.

    • shapePos2: Vector

      The initial position of the second shape.

    • shapeRot2: Rotation

      The rotation of the second shape.

    • shapeVel2: Vector

      The velocity of the second shape.

    • targetDistance: number

      − If the shape moves closer to this distance from a collider, a hit will be returned.

    • maxToi: number

      The maximum time when the impact can happen.

    • stopAtPenetration: boolean

      If set to false, the linear shape-cast won’t immediately stop if the shape is penetrating another shape at its starting point and its trajectory is such that it’s on a path to exist that penetration state.

    Returns ShapeCastHit

  • Computes one pair of contact points between two shapes.

    Returns

    null if the shapes are separated by a distance greater than prediction, otherwise contact details. The result is given in world-space.

    Parameters

    • shapePos1: Vector

      The initial position of this sahpe.

    • shapeRot1: Rotation

      The rotation of this shape.

    • shape2: Shape

      The second shape.

    • shapePos2: Vector

      The initial position of the second shape.

    • shapeRot2: Rotation

      The rotation of the second shape.

    • prediction: number

      The prediction value, if the shapes are separated by a distance greater than this value, test will fail.

    Returns ShapeContact

  • Tests if this shape intersects another shape.

    Returns

    true if the two shapes intersect, false if they don’t.

    Parameters

    • shapePos1: Vector

      The position of this shape.

    • shapeRot1: Rotation

      The rotation of this shape.

    • shape2: Shape

      The second shape to test.

    • shapePos2: Vector

      The position of the second shape.

    • shapeRot2: Rotation

      The rotation of the second shape.

    Returns boolean

  • Returns RawShape

  • instant mode without cache

    Parameters

    • rawSet: RawColliderSet
    • handle: number

    Returns Shape

Generated using TypeDoc