Class ColliderDesc

Hierarchy

  • ColliderDesc

Constructors

  • Initializes a collider descriptor from the collision shape.

    Parameters

    • shape: Shape

      The shape of the collider being built.

    Returns ColliderDesc

Properties

activeCollisionTypes: ActiveCollisionTypes
activeEvents: ActiveEvents
activeHooks: ActiveHooks
angularInertiaLocalFrame: Rotation
centerOfMass: Vector
collisionGroups: number
contactForceEventThreshold: number
contactSkin: number
density: number
enabled: boolean
friction: number
frictionCombineRule: CoefficientCombineRule
isSensor: boolean
mass: number
massPropsMode: MassPropsMode
principalAngularInertia: Vector
restitution: number
restitutionCombineRule: CoefficientCombineRule
rotation: Rotation
shape: Shape
solverGroups: number
translation: Vector

Methods

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

  • 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

    • groups: number

      The collision groups used for the collider being built.

    Returns ColliderDesc

  • Sets the total force magnitude beyond which a contact force event can be emitted.

    Parameters

    • threshold: number

      The force threshold to set.

    Returns ColliderDesc

  • Sets the contact skin of the collider.

    The contact skin acts as if the collider was enlarged with a skin of width skin_thickness around it, keeping objects further apart when colliding.

    A non-zero contact skin can increase performance, and in some cases, stability. However it creates a small gap between colliding object (equal to the sum of their skin). If the skin is sufficiently small, this might not be visually significant or can be hidden by the rendering assets.

    Parameters

    • thickness: number

    Returns ColliderDesc

  • Sets the density of the collider being built.

    The mass and angular inertia tensor will be computed automatically based on this density and the collider’s shape.

    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 whether the created collider will be enabled or disabled.

    Parameters

    • enabled: boolean

      − If set to false the collider will be disabled at creation.

    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

  • Sets the mass of the collider being built.

    The angular inertia tensor will be computed automatically based on this mass and the collider’s shape.

    Parameters

    • mass: number

      The mass to set, must be greater or equal to 0.

    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: Vector

      − The initial principal angular inertia of the collider to create. These are the eigenvalues of the angular inertia matrix.

    • angularInertiaLocalFrame: Rotation

      − The initial local angular inertia frame of the collider to create. These are the eigenvectors of the angular inertia matrix.

    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

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

    • sensor: boolean

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

    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

    • groups: number

      The solver groups used for the collider being built.

    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
    • z: number

    Returns ColliderDesc

  • 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 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 cone shape.

    Parameters

    • halfHeight: number

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

    • radius: number

      The radius of the cone basis.

    Returns ColliderDesc

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

    Parameters

    • points: Float32Array

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

    Returns ColliderDesc

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

    • Optional indices: Uint32Array

    Returns ColliderDesc

  • Creates a new collider descriptor with a cuboid 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.

    • hz: number

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

    Returns ColliderDesc

  • Create a new collider descriptor with a cylinder shape.

    Parameters

    • halfHeight: number

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

    • radius: number

      The radius of the cylinder basis.

    Returns ColliderDesc

  • Creates a new collider descriptor with a 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 scale factor applied to the heightfield.

    • Optional flags: FIX_INTERNAL_EDGES

    Returns ColliderDesc

  • Creates a new collider descriptor with a polyline shape.

    Parameters

    • vertices: Float32Array

      The coordinates of the polyline's vertices.

    • Optional indices: Uint32Array

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

    Returns ColliderDesc

  • Create a new collider descriptor with a cone shape with rounded corners.

    Parameters

    • halfHeight: number

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

    • radius: number

      The radius of the cone basis.

    • borderRadius: number

      The radius of the cone's rounded edges and vertices.

    Returns ColliderDesc

  • Computes the convex-hull of the given points and use the resulting convex polyhedron as the shape for this new collider descriptor. A border is added to that convex polyhedron 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 polyhedron.

    Returns ColliderDesc

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

    • indices: Uint32Array
    • borderRadius: number

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

    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.

    • hz: number

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

    • borderRadius: number

      The radius of the cuboid's borders.

    Returns ColliderDesc

  • Create a new collider descriptor with a cylinder shape with rounded corners.

    Parameters

    • halfHeight: number

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

    • radius: number

      The radius of the cylinder basis.

    • borderRadius: number

      The radius of the cylinder's rounded edges and vertices.

    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

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

    • Optional flags: TriMeshFlags

    Returns ColliderDesc

Generated using TypeDoc