Class: ManifoldMap
physics/manifoldMap.ManifoldMap
Represents a 2 layered {@link Map} containing Manifolds for CollisionObject pairs.
Constructors
constructor
โข new ManifoldMap()
Properties
map
โข map: Map
<CollisionObject
, Map
<CollisionObject
, Manifold
>>
Defined in
src/physics/manifoldMap.ts:9
Methods
addManifold
โธ addManifold(a
, b
, m
): void
Adds a manifold to the map with the top level key being a
and inner key being b
.
If a manifold is already in the map with key [b, a] then that manifold will be updated instead.
Parameters
Name | Type | Description |
---|---|---|
a | CollisionObject | The first object for the key |
b | CollisionObject | The second object for the key |
m | Manifold | The manifold to insert |
Returns
void
Defined in
src/physics/manifoldMap.ts:79
getAllManifolds
โธ getAllManifolds(): Manifold
[]
Gets all the manifolds in the map and returns them as a contiguous array.
Returns
Manifold
[]
All the manifolds in the map as an array
Defined in
src/physics/manifoldMap.ts:16
getManifold
โธ getManifold(a
, b
): Manifold
Finds a manifold in the ManifoldMap.
Parameters
Name | Type | Description |
---|---|---|
a | CollisionObject | The first collision object |
b | CollisionObject | The second collision object |
Returns
The manifold for the collision between a and b or undefined.
Defined in
src/physics/manifoldMap.ts:34
getManifoldKey
โธ getManifoldKey(a
, b
): Object
Finds the correct key in the map for objects a
and b
.
Parameters
Name | Type | Description |
---|---|---|
a | CollisionObject | An object in the key |
b | CollisionObject | An object in the key |
Returns
Object
The manifold key or undefined
Name | Type |
---|---|
key | CollisionObject |
top | CollisionObject |
Defined in
src/physics/manifoldMap.ts:54
killAllManifolds
โธ killAllManifolds(): void
Sets isDead
to true for every manifold in the map.
Returns
void
Defined in
src/physics/manifoldMap.ts:156
removeDeadManifolds
โธ removeDeadManifolds(): void
Removes all manifolds in the map which have isDead
set to true.
Returns
void
Defined in
src/physics/manifoldMap.ts:141
removeManifold
โธ removeManifold(a
, b
): boolean
Removes the manifold involving objects a
and b
.
Parameters
Name | Type | Description |
---|---|---|
a | CollisionObject | An object in the manifold |
b | CollisionObject | Another object in the manifold |
Returns
boolean
Wether or not a manifold was removed
Defined in
src/physics/manifoldMap.ts:116
removeManifoldsInvolving
โธ removeManifoldsInvolving(obj
): void
Removes all manifolds involving the given object.
Parameters
Name | Type | Description |
---|---|---|
obj | CollisionObject | The obj to remove manifolds of |
Returns
void
Defined in
src/physics/manifoldMap.ts:131