Skip to main content

Class: ConstraintSpace

physics/spaces/constraints.ConstraintSpace

Contains Constraints involving CollisionObjects.

Hierarchy

Constructors

constructor

โ€ข new ConstraintSpace()

Inherited from

Space.constructor

Properties

objects

โ€ข objects: Constraint[] = []

Inherited from

Space.objects

Defined in

src/physics/spaces/space.ts:8


solvers

โ€ข solvers: Object = {}

Index signature

โ–ช [index: string]: { cb: S ; iterations: number }

Inherited from

Space.solvers

Defined in

src/physics/spaces/space.ts:9

Methods

addObject

โ–ธ addObject(obj): void

Adds an object to the space.

Parameters

NameTypeDescription
objConstraintThe object to add

Returns

void

Inherited from

Space.addObject

Defined in

src/physics/spaces/space.ts:50


addSolver

โ–ธ addSolver(id, cb, iterations): void

Adds a solver to the space.

Parameters

NameTypeDescription
idstringThe solver's identifier
cbConstraintSolverThe solver to add
iterationsnumberThe number of times to run the solver, per time step

Returns

void

Inherited from

Space.addSolver

Defined in

src/physics/spaces/space.ts:91


clearObjects

โ–ธ clearObjects(): void

Removes all objects from the space.

Returns

void

Inherited from

Space.clearObjects

Defined in

src/physics/spaces/space.ts:41


clearSolvers

โ–ธ clearSolvers(): void

Removes all solvers from the space.

Returns

void

Inherited from

Space.clearSolvers

Defined in

src/physics/spaces/space.ts:80


getObjects

โ–ธ getObjects(): Constraint[]

Gets all objects in the space.

Returns

Constraint[]

All objects in the space

Inherited from

Space.getObjects

Defined in

src/physics/spaces/space.ts:34


getSolvers

โ–ธ getSolvers(): Object

Gets all solvers in the space.

Returns

Object

All solvers in the space

Inherited from

Space.getSolvers

Defined in

src/physics/spaces/space.ts:73


removeObject

โ–ธ removeObject(obj): boolean

Removes an object from the space.

Parameters

NameTypeDescription
objConstraintThe object to remove

Returns

boolean

Wether or not the object was removed

Inherited from

Space.removeObject

Defined in

src/physics/spaces/space.ts:60


removeSolver

โ–ธ removeSolver(id): boolean

Removes a solver from the space.

Parameters

NameTypeDescription
idstringThe id of the solver to remove

Returns

boolean

Wether or not the solver was removed

Inherited from

Space.removeSolver

Defined in

src/physics/spaces/space.ts:101


setSolverIterations

โ–ธ setSolverIterations(id, iterations): void

Sets the number of iterations a solver should run.

Parameters

NameTypeDescription
idstringThe id of the solver to update
iterationsnumberThe new number of iterations

Returns

void

Inherited from

Space.setSolverIterations

Defined in

src/physics/spaces/space.ts:112


solve

โ–ธ solve(id, delta): void

Executes a solver on every object in the space.

Parameters

NameTypeDescription
idstringThe id of the solver to execute
deltanumber-

Returns

void

Overrides

Space.solve

Defined in

src/physics/spaces/constraints.ts:14