Collider

interface Collider

A physical volume in space which can be collided with by other physics structures. This holds a shape and physics properties, and may be attached to a PhysicsSpace to simulate it inside that space. A collider may also be attached (parented) to a RigidBody, which will make the collider determine its position based on its parent body.

Attaching

A collider may optionally be attached to a RigidBody in the same PhysicsSpace by providing the RigidBodyKey. This has the effect of forcing the collider's position to be relative to the body's - it is effectively parented to that body. This means that setting position has no effect - instead, use relativePosition, which sets the offset relative to this parent body. This persists even if the parent body is removed.

Interaction groups

A collider has two InteractionGroups, which determine if a pair of colliders are considered in contact:

  • collisionGroup - filters what pairs of colliders should have contacts generated. This happens after the broad-phase, at the beginning of the narrow-phase (see PhysicsEngine.stepSpaces).

  • solverGroup - filters what pairs of colliders, with contacts already generated, should compute contact forces. This happens at the end of the narrow-phase.

Typically, you would want to modify the collisionGroup to filter out contacts as early as possible; unless you want contacts to be generated, but the forces to not be computed (maybe you want to modify them yourself later), in which case you would use the solverGroup.

Inheritors

Types

Link copied to clipboard
interface Mass

Mass properties of a Collider, used in calculating forces and dynamics during the simulation.

Link copied to clipboard
interface Mut : Collider

Mutable interface for a Collider.

Link copied to clipboard

Mutable owned interface for a Collider.

Link copied to clipboard
interface Start

Defines the starting position for a Collider.

Properties

Link copied to clipboard

The primary, contact-generation, interaction group (see Collider).

Link copied to clipboard
abstract val density: Double

The density of the collider, in kg/m^3.

Link copied to clipboard
abstract val mass: Double

The mass of the collider, in kg.

Link copied to clipboard

The physics properties.

Link copied to clipboard
abstract val parent: RigidBodyKey?

The handle of which body this collider will follow (see Collider).

Link copied to clipboard
abstract val physicsMode: PhysicsMode

The physics mode.

Link copied to clipboard
abstract val position: DIso3

The absolute position of the collider in the physics space, i.e. not relative to its parent body.

Link copied to clipboard
abstract val relativePosition: DIso3

The position of the collider relative to its parent body. Even if the collider has no parent, this will keep the last set relative position.

Link copied to clipboard
abstract val shape: Shape

The shape that this collider takes on in the world.

Link copied to clipboard

The secondary, contact-application, interaction group (see Collider).

Functions

Link copied to clipboard
abstract fun bounds(): DAabb3

The world-space bounding box of this collider, determined by its shape and position.