Options
All
  • Public
  • Public/Protected
  • All
Menu

A shape that is a box in 3D and a rectangle in 2D, with round corners.

Hierarchy

Index

Constructors

  • new RoundCuboid(hx: number, hy: number, hz: number, borderRadius: number): RoundCuboid
  • Creates a new 3D cuboid.

    Parameters

    • hx: number

      The half width of the cuboid.

    • hy: number

      The half height of the cuboid.

    • hz: number

      The half depth of the cuboid.

    • borderRadius: number

      The radius of the borders of this cuboid. This will effectively increase the half-extents of the cuboid by this radius.

    Returns RoundCuboid

Properties

borderRadius: number

The radius of the cuboid's round border.

halfExtents: Vector

The half extent of the cuboid along each coordinate axis.

type: RoundCuboid = ShapeType.RoundCuboid

Methods

  • castRay(ray: Ray, shapePos: Vector, shapeRot: Rotation, maxToi: number, solid: boolean): number
  • 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.

    • 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 ShapeTOI

    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.

  • intersectsRay(ray: Ray, shapePos: Vector, shapeRot: Rotation, maxToi: number): 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.

  • intoRaw(): RawShape
  • Returns RawShape

  • fromRaw(rawSet: RawColliderSet, handle: number): Shape
  • instant mode without cache

    Parameters

    • rawSet: RawColliderSet
    • handle: number

    Returns Shape

Generated using TypeDoc