A shape made of voxels.

Hierarchy (view full)

Constructors

  • Creates a new shape made of voxels.

    Parameters

    • data: Int32Array | Float32Array

      Defines the set of voxels. If this is a Int32Array then each voxel is defined from its (signed) grid coordinates, with 3 (resp 2) contiguous integers per voxel in 3D (resp 2D). If this is a Float32Array, each voxel will be such that they contain at least one point from this array (where each point is defined from 3 (resp 2) contiguous numbers per point in 3D (resp 2D).

    • voxelSize: Vector

      The size of each voxel.

    Returns Voxels

Properties

data: Int32Array | Float32Array

The points or grid coordinates used to initialize the voxels.

type: Voxels = ShapeType.Voxels
voxelSize: Vector

The dimensions of each voxel.

Methods

  • Parameters

    Returns number

  • Computes the time of impact between two moving shapes.

    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 exit that penetration state.

    Returns ShapeCastHit

    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.

  • Computes one pair of contact points between two shapes.

    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

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

  • Parameters

    Returns boolean

  • Tests if this shape intersects another shape.

    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

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

  • Returns RawShape

  • instant mode without cache

    Parameters

    • rawSet: RawColliderSet
    • handle: number

    Returns Shape