Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ColliderDesc

Hierarchy

  • ColliderDesc

Index

Constructors

constructor

  • Initializes a collider descriptor from the collision shape.

    Parameters

    • shape: Shape

      The shape of the collider being built.

    Returns ColliderDesc

  • Initializes a collider descriptor from the collision shape.

    Parameters

    • shape: Shape

      The shape of the collider being built.

    Returns ColliderDesc

Properties

activeCollisionTypes

activeCollisionTypes: ActiveCollisionTypes

activeEvents

activeEvents: ActiveEvents

activeHooks

activeHooks: ActiveHooks

centerOfMass

centerOfMass: Vector

collisionGroups

collisionGroups: InteractionGroups

density

density: number

friction

friction: number

frictionCombineRule

frictionCombineRule: CoefficientCombineRule

isSensor

isSensor: boolean

mass

mass: number

principalAngularInertia

principalAngularInertia: number

restitution

restitution: number

restitutionCombineRule

restitutionCombineRule: CoefficientCombineRule

rotation

rotation: Rotation

rotationsEnabled

rotationsEnabled: boolean

shape

shape: Shape

solverGroups

solverGroups: InteractionGroups

translation

translation: Vector

useMassProps

useMassProps: boolean

Methods

setActiveCollisionTypes

  • Set the collision types active for this collider.

    Parameters

    • activeCollisionTypes: ActiveCollisionTypes

      The hooks active for contact/intersection pairs involving this collider.

    Returns ColliderDesc

  • Set the collision types active for this collider.

    Parameters

    • activeCollisionTypes: ActiveCollisionTypes

      The hooks active for contact/intersection pairs involving this collider.

    Returns ColliderDesc

setActiveEvents

  • Set the events active for this collider.

    Use this to enable contact and/or intersection event reporting for this collider.

    Parameters

    • activeEvents: ActiveEvents

      The events active for contact/intersection pairs involving this collider.

    Returns ColliderDesc

  • Set the events active for this collider.

    Use this to enable contact and/or intersection event reporting for this collider.

    Parameters

    • activeEvents: ActiveEvents

      The events active for contact/intersection pairs involving this collider.

    Returns ColliderDesc

setActiveHooks

  • Set the physics hooks active for this collider.

    Use this to enable custom filtering rules for contact/intersecstion pairs involving this collider.

    Parameters

    • activeHooks: ActiveHooks

      The hooks active for contact/intersection pairs involving this collider.

    Returns ColliderDesc

  • Set the physics hooks active for this collider.

    Use this to enable custom filtering rules for contact/intersecstion pairs involving this collider.

    Parameters

    • activeHooks: ActiveHooks

      The hooks active for contact/intersection pairs involving this collider.

    Returns ColliderDesc

setCollisionGroups

  • Sets the collision groups used by this collider.

    Two colliders will interact iff. their collision groups are compatible. See the documentation of InteractionGroups for details on teh used bit pattern.

    Parameters

    Returns ColliderDesc

  • Sets the collision groups used by this collider.

    Two colliders will interact iff. their collision groups are compatible. See the documentation of InteractionGroups for details on teh used bit pattern.

    Parameters

    Returns ColliderDesc

setDensity

  • Sets the density of the collider being built.

    Parameters

    • density: number

      The density to set, must be greater or equal to 0. A density of 0 means that this collider will not affect the mass or angular inertia of the rigid-body it is attached to.

    Returns ColliderDesc

  • Sets the density of the collider being built.

    Parameters

    • density: number

      The density to set, must be greater or equal to 0. A density of 0 means that this collider will not affect the mass or angular inertia of the rigid-body it is attached to.

    Returns ColliderDesc

setFriction

  • Sets the friction coefficient of the collider to be created.

    Parameters

    • friction: number

      The friction coefficient. Must be greater or equal to 0. This is generally smaller than 1. The higher the coefficient, the stronger friction forces will be for contacts with the collider being built.

    Returns ColliderDesc

  • Sets the friction coefficient of the collider to be created.

    Parameters

    • friction: number

      The friction coefficient. Must be greater or equal to 0. This is generally smaller than 1. The higher the coefficient, the stronger friction forces will be for contacts with the collider being built.

    Returns ColliderDesc

setFrictionCombineRule

  • Sets the rule used to combine the friction coefficients of two colliders colliders involved in a contact.

    Parameters

    Returns ColliderDesc

  • Sets the rule used to combine the friction coefficients of two colliders colliders involved in a contact.

    Parameters

    Returns ColliderDesc

setMassProperties

  • setMassProperties(mass: number, centerOfMass: Vector, principalAngularInertia: number): ColliderDesc
  • setMassProperties(mass: number, centerOfMass: Vector, principalAngularInertia: number): ColliderDesc
  • Sets the mass properties of the collider being built.

    This replaces the mass-properties automatically computed from the collider's density and shape. These mass-properties will be added to the mass-properties of the rigid-body this collider will be attached to.

    Parameters

    • mass: number

      − The mass of the collider to create.

    • centerOfMass: Vector

      − The center-of-mass of the collider to create.

    • principalAngularInertia: number

      − The principal angular inertia of the collider to create.

    Returns ColliderDesc

  • Sets the mass properties of the collider being built.

    This replaces the mass-properties automatically computed from the collider's density and shape. These mass-properties will be added to the mass-properties of the rigid-body this collider will be attached to.

    Parameters

    • mass: number

      − The mass of the collider to create.

    • centerOfMass: Vector

      − The center-of-mass of the collider to create.

    • principalAngularInertia: number

      − The principal angular inertia of the collider to create.

    Returns ColliderDesc

setRestitution

  • Sets the restitution coefficient of the collider to be created.

    Parameters

    • restitution: number

      The restitution coefficient in [0, 1]. A value of 0 (the default) means no bouncing behavior while 1 means perfect bouncing (though energy may still be lost due to numerical errors of the constraints solver).

    Returns ColliderDesc

  • Sets the restitution coefficient of the collider to be created.

    Parameters

    • restitution: number

      The restitution coefficient in [0, 1]. A value of 0 (the default) means no bouncing behavior while 1 means perfect bouncing (though energy may still be lost due to numerical errors of the constraints solver).

    Returns ColliderDesc

setRestitutionCombineRule

  • Sets the rule used to combine the restitution coefficients of two colliders colliders involved in a contact.

    Parameters

    Returns ColliderDesc

  • Sets the rule used to combine the restitution coefficients of two colliders colliders involved in a contact.

    Parameters

    Returns ColliderDesc

setRotation

  • Sets the rotation of the collider to be created relative to the rigid-body it is attached to.

    Parameters

    • rot: Rotation

      The rotation of the collider to be created relative to the rigid-body it is attached to.

    Returns ColliderDesc

  • Sets the rotation of the collider to be created relative to the rigid-body it is attached to.

    Parameters

    • rot: Rotation

      The rotation of the collider to be created relative to the rigid-body it is attached to.

    Returns ColliderDesc

setSensor

  • Sets whether or not the collider being created is a sensor.

    A sensor collider does not take part of the physics simulation, but generates proximity events.

    Parameters

    • is: boolean

      Set to true of the collider built is to be a sensor.

    Returns ColliderDesc

  • Sets whether or not the collider being created is a sensor.

    A sensor collider does not take part of the physics simulation, but generates proximity events.

    Parameters

    • is: boolean

      Set to true of the collider built is to be a sensor.

    Returns ColliderDesc

setSolverGroups

  • Sets the solver groups used by this collider.

    Forces between two colliders in contact will be computed iff their solver groups are compatible. See the documentation of InteractionGroups for details on the used bit pattern.

    Parameters

    Returns ColliderDesc

  • Sets the solver groups used by this collider.

    Forces between two colliders in contact will be computed iff their solver groups are compatible. See the documentation of InteractionGroups for details on the used bit pattern.

    Parameters

    Returns ColliderDesc

setTranslation

  • Sets the position of the collider to be created relative to the rigid-body it is attached to.

    Parameters

    • x: number
    • y: number

    Returns ColliderDesc

  • Sets the position of the collider to be created relative to the rigid-body it is attached to.

    Parameters

    • x: number
    • y: number

    Returns ColliderDesc

Static ball

  • Create a new collider descriptor with a ball shape.

    Parameters

    • radius: number

      The radius of the ball.

    Returns ColliderDesc

  • Create a new collider descriptor with a ball shape.

    Parameters

    • radius: number

      The radius of the ball.

    Returns ColliderDesc

Static capsule

  • Create a new collider descriptor with a capsule shape.

    Parameters

    • halfHeight: number

      The half-height of the capsule, along the y axis.

    • radius: number

      The radius of the capsule basis.

    Returns ColliderDesc

  • Create a new collider descriptor with a capsule shape.

    Parameters

    • halfHeight: number

      The half-height of the capsule, along the y axis.

    • radius: number

      The radius of the capsule basis.

    Returns ColliderDesc

Static convexHull

  • Computes the convex-hull of the given points and use the resulting convex polygon as the shape for this new collider descriptor.

    Parameters

    • points: Float32Array

      The point that will be used to compute the convex-hull.

    Returns ColliderDesc | null

  • Computes the convex-hull of the given points and use the resulting convex polygon as the shape for this new collider descriptor.

    Parameters

    • points: Float32Array

      The point that will be used to compute the convex-hull.

    Returns ColliderDesc | null

Static convexPolyline

  • convexPolyline(vertices: Float32Array): ColliderDesc | null
  • convexPolyline(vertices: Float32Array): ColliderDesc | null
  • Creates a new collider descriptor that uses the given set of points assumed to form a convex polyline (no convex-hull computation will be done).

    Parameters

    • vertices: Float32Array

      The vertices of the convex polyline.

    Returns ColliderDesc | null

  • Creates a new collider descriptor that uses the given set of points assumed to form a convex polyline (no convex-hull computation will be done).

    Parameters

    • vertices: Float32Array

      The vertices of the convex polyline.

    Returns ColliderDesc | null

Static cuboid

  • Creates a new collider descriptor with a rectangular shape.

    Parameters

    • hx: number

      The half-width of the rectangle along its local x axis.

    • hy: number

      The half-width of the rectangle along its local y axis.

    Returns ColliderDesc

  • Creates a new collider descriptor with a rectangular shape.

    Parameters

    • hx: number

      The half-width of the rectangle along its local x axis.

    • hy: number

      The half-width of the rectangle along its local y axis.

    Returns ColliderDesc

Static heightfield

  • Creates a new collider descriptor with a heightfield shape.

    Parameters

    • heights: Float32Array

      The heights of the heightfield, along its local y axis.

    • scale: Vector

      The scale factor applied to the heightfield.

    Returns ColliderDesc

  • Creates a new collider descriptor with a heightfield shape.

    Parameters

    • heights: Float32Array

      The heights of the heightfield, along its local y axis.

    • scale: Vector

      The scale factor applied to the heightfield.

    Returns ColliderDesc

Static polyline

  • polyline(vertices: Float32Array, indices: Uint32Array): ColliderDesc
  • polyline(vertices: Float32Array, indices: Uint32Array): ColliderDesc
  • Creates a new collider descriptor with a polyline shape.

    Parameters

    • vertices: Float32Array

      The coordinates of the polyline's vertices.

    • indices: Uint32Array

      The indices of the polyline's segments. If this is null, the vertices are assumed to describe a line strip.

    Returns ColliderDesc

  • Creates a new collider descriptor with a polyline shape.

    Parameters

    • vertices: Float32Array

      The coordinates of the polyline's vertices.

    • indices: Uint32Array

      The indices of the polyline's segments. If this is null, the vertices are assumed to describe a line strip.

    Returns ColliderDesc

Static roundConvexHull

  • roundConvexHull(points: Float32Array, borderRadius: number): ColliderDesc | null
  • roundConvexHull(points: Float32Array, borderRadius: number): ColliderDesc | null
  • Computes the convex-hull of the given points and use the resulting convex polygon as the shape for this new collider descriptor. A border is added to that convex polygon to give it round corners.

    Parameters

    • points: Float32Array

      The point that will be used to compute the convex-hull.

    • borderRadius: number

      The radius of the round border added to the convex polygon.

    Returns ColliderDesc | null

  • Computes the convex-hull of the given points and use the resulting convex polygon as the shape for this new collider descriptor. A border is added to that convex polygon to give it round corners.

    Parameters

    • points: Float32Array

      The point that will be used to compute the convex-hull.

    • borderRadius: number

      The radius of the round border added to the convex polygon.

    Returns ColliderDesc | null

Static roundConvexPolyline

  • roundConvexPolyline(vertices: Float32Array, borderRadius: number): ColliderDesc | null
  • roundConvexPolyline(vertices: Float32Array, borderRadius: number): ColliderDesc | null
  • Creates a new collider descriptor that uses the given set of points assumed to form a round convex polyline (no convex-hull computation will be done).

    Parameters

    • vertices: Float32Array

      The vertices of the convex polyline.

    • borderRadius: number

      The radius of the round border added to the convex polyline.

    Returns ColliderDesc | null

  • Creates a new collider descriptor that uses the given set of points assumed to form a round convex polyline (no convex-hull computation will be done).

    Parameters

    • vertices: Float32Array

      The vertices of the convex polyline.

    • borderRadius: number

      The radius of the round border added to the convex polyline.

    Returns ColliderDesc | null

Static roundCuboid

  • roundCuboid(hx: number, hy: number, borderRadius: number): ColliderDesc
  • roundCuboid(hx: number, hy: number, borderRadius: number): ColliderDesc
  • Creates a new collider descriptor with a rectangular shape with round borders.

    Parameters

    • hx: number

      The half-width of the rectangle along its local x axis.

    • hy: number

      The half-width of the rectangle along its local y axis.

    • borderRadius: number

      The radius of the cuboid's borders.

    Returns ColliderDesc

  • Creates a new collider descriptor with a rectangular shape with round borders.

    Parameters

    • hx: number

      The half-width of the rectangle along its local x axis.

    • hy: number

      The half-width of the rectangle along its local y axis.

    • borderRadius: number

      The radius of the cuboid's borders.

    Returns ColliderDesc

Static roundTriangle

  • Creates a new triangle shape with round corners.

    Parameters

    • a: Vector

      The first point of the triangle.

    • b: Vector

      The second point of the triangle.

    • c: Vector

      The third point of the triangle.

    • borderRadius: number

      The radius of the borders of this triangle. In 3D, this is also equal to half the thickness of the triangle.

    Returns ColliderDesc

  • Creates a new triangle shape with round corners.

    Parameters

    • a: Vector

      The first point of the triangle.

    • b: Vector

      The second point of the triangle.

    • c: Vector

      The third point of the triangle.

    • borderRadius: number

      The radius of the borders of this triangle. In 3D, this is also equal to half the thickness of the triangle.

    Returns ColliderDesc

Static segment

  • Creates a new segment shape.

    Parameters

    • a: Vector

      The first point of the segment.

    • b: Vector

      The second point of the segment.

    Returns ColliderDesc

  • Creates a new segment shape.

    Parameters

    • a: Vector

      The first point of the segment.

    • b: Vector

      The second point of the segment.

    Returns ColliderDesc

Static triangle

  • Creates a new triangle shape.

    Parameters

    • a: Vector

      The first point of the triangle.

    • b: Vector

      The second point of the triangle.

    • c: Vector

      The third point of the triangle.

    Returns ColliderDesc

  • Creates a new triangle shape.

    Parameters

    • a: Vector

      The first point of the triangle.

    • b: Vector

      The second point of the triangle.

    • c: Vector

      The third point of the triangle.

    Returns ColliderDesc

Static trimesh

  • trimesh(vertices: Float32Array, indices: Uint32Array): ColliderDesc
  • trimesh(vertices: Float32Array, indices: Uint32Array): ColliderDesc
  • Creates a new collider descriptor with a triangle mesh shape.

    Parameters

    • vertices: Float32Array

      The coordinates of the triangle mesh's vertices.

    • indices: Uint32Array

      The indices of the triangle mesh's triangles.

    Returns ColliderDesc

  • Creates a new collider descriptor with a triangle mesh shape.

    Parameters

    • vertices: Float32Array

      The coordinates of the triangle mesh's vertices.

    • indices: Uint32Array

      The indices of the triangle mesh's triangles.

    Returns ColliderDesc

Generated using TypeDoc