Core of the physics component supporting motion and collision resolution
Found in Chapter 9, page 558 of the textbook
Examples: 9.5 Rigid Shape Movements, 9.8 Collision Angular Resolution, 9.9 Physics Presets- Source:
Methods
(inner) collideShape(s1, s2, infoSet) → {boolean}
Collide two rigid shapes
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
s1 |
RigidShape | the first RigidShape involved | |
s2 |
RigidShape | the second RigidShape involved | |
infoSet |
Array.<CollisionInfo> | null | list of CollisionInfo objects to append to |
- Source:
Returns:
true if a collision occured
- Type
- boolean
(inner) getHasMotion() → {boolean}
Returns whether there is motion
- Source:
Returns:
true if there is motion
- Type
- boolean
(inner) getPositionalCorrection() → {boolean}
Returns whether the RigidShapes are in correct positions
- Source:
Returns:
true if every RigidShape is in the correct position
- Type
- boolean
(inner) getRelaxationCount() → {integer}
Returns the relaxation count
- Source:
Returns:
mRelaxationCount - the number of relaxation cycles
- Type
- integer
(inner) getSystemAcceleration() → {vec2}
Returns the acceleration of the system in world coordinates
- Source:
Returns:
the [X,Y] acceleration vector
- Type
- vec2
(inner) incRelaxationCount(dc)
Add a value to the relaxation count
Parameters:
| Name | Type | Description |
|---|---|---|
dc |
integer | the number of relaxation cycles to add |
- Source:
(inner) processObjToSet(obj, set, infoSet) → {boolean}
Collide a given GameObject with an entire GameObjectSet
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
obj |
GameObject | the specific GameObject to test collision with | |
set |
GameObjectSet | the GameObjectSet to test collision against | |
infoSet |
Array.<CollisionInfo> | null | list of CollisionInfo objects to append to |
- Source:
Returns:
true if a collision occured
- Type
- boolean
(inner) processSet(set, infoSet) → {boolean}
Collide every GameObject within the GameObjectSet with each other
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
set |
GameObjectSet | the GameObjectSet to test collision with and against | |
infoSet |
Array.<CollisionInfo> | null | list of CollisionInfo objects to append to |
- Source:
Returns:
true if a collision occured
- Type
- boolean
(inner) processSetToSet(set1, set2, infoSet) → {boolean}
Collide every GameObject within a GameObjectSet with an entire other GameObjectSet
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
set1 |
GameObjectSet | the first GameObjectSet to test collision with | |
set2 |
GameObjectSet | the second GameObjectSet to test collision against | |
infoSet |
Array.<CollisionInfo> | null | list of CollisionInfo objects to append to |
- Source:
Returns:
true if a collision occured
- Type
- boolean
(inner) setSystemAcceleration(x, y)
Sets the acceleration of the sytsem in world coordinates
Parameters:
| Name | Type | Description |
|---|---|---|
x |
float | the acceleration in the X direction |
y |
float | the acceleration in the Y direction |
- Source:
(inner) toggleHasMotion()
Toggles the state of the has motion flag
- Source:
(inner) togglePositionalCorrection()
Toggles the state of the correction flag
- Source: