Collision Detection and Resolution

22 flashcardsby Nijelous
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
Collision Volumes
An attribute of a physics body, defining its basic shape.

Used to determine when two objects overlap.
2
Bounding Spheres
Spherical collision volume

Has position and radius around position
3
Bounding Box
Rectangular collision volume

Defined in two ways:
-Width, Length and Height
-Half Size along each axis from centre
4
Axis Aligned Bounding Box
Bounding Box where half sizes will always point in the direction of the global coordinate axes, no matter the orientation of the physics body.
Easier calculation of collisions
5
Oriented Bounding Boxes
Bounding Box where the axes change direction to match the orientation.
Harder calculation of collisions, as it could be the y axis of one box hitting the x axis of another
6
Collision Pairs
A pair of collision bodies that are overlapping, generated for each set during the detection phase
7
Overall Collision Detection
Runs in two phases to allow for better performance.
Broad Phase: Determines objects that could never collide and culls them from each others collision sets.
Narrow Phase: Runs actual detection using the potential collision pairs from the broad phase.
8
Sort and Sweep Algorithm
Sorts bodies so they are spatially coherent, either just along one axis or along all axes.

-As the algorithm sweeps across the axis, adds objects to a list as it reaches its minimum extent on that axis
-If there are two or more objects now in the list, adds them to a list of possible collision pairs
-Removes items when the maximum extent on the axis is reached
9
QuadTree
Subdivides the area into quarters in order to group collision pairs. Has a maximum node volume (how many objects a node can hold before splitting) and maximum depth (how many nodes deep the tree can go).
The overall area is the root node, represented as a square, if the maximum node volume is reached, the area is split into equally sized smaller nodes.

Only volumes in the same leaf node are considered in detection
10
Octree
3D QuadTree, splitting into 8 cubes rather than 4 squares on node creation
11
Penetration Distance
How much two objects are overlapping each other
12
Collision Normal
Direction of a collision
13
Sphere-Sphere Collision Detection
Calculate distance d between the two spheres.
If d < sum of the radii, spheres are colliding

Penetration Distance: Difference between the sum of the radii and d
Collision Normal: Normalised direction vector between the two bodies
14
AABB-AABB Collision Detection
Calculate if, on every axis, the distance between the objects is less than the sum of the half sizes.

Penetration Distance: The smallest difference between two axes
Collision Normal: Whichever side has the least amount of intersection
15
Sphere-AABB Collision Detection
Find the closest point on AABB to the sphere (by clamping the sphere's position on each axis between the min and max of the AABB). If this is less than the sphere's radius away from the sphere's centre, they're colliding.

Penetration Distance: Difference between sphere's radius and the distance between the closest point and the sphere's origin
Collision Normal: Direction vector between the closest point and the sphere's position.
16
Bounding Hierarchies
A tree of sphere or box colliders, the parent encapsulating all child colliders. Used for complex shapes with complex collision areas.

Calculate if the root collides first, if it does, check the children, etc.
17
Collision Resolution: Projection
Makes sure the objects are no longer overlapping by directly moving them (projecting them).

Calculation:
-collision normal * collision penetration * (inverse mass of object/total inverse mass)
18
Collision Resolution: Impulses
Need to conserve momentum and apply forces to the objects to change acceleration accordingly.

Impulse Calculation:
J = -(1+e) vr.normal/total inverse mass

vr = vb - va

We apply this directly to the velocity in order to apply the force correctly.

new velocity = velocity +/- inverse mass * J * collision normal
19
Coefficient of Restitution
Number that serves as an index of elasticity for colliding bodies, e.
If an object is entirely elastic, e = 1.0
If an object is entirely inelastic, e = 0
20
Static Objects
Physics objects that never move. These are never tested against each other for collision detection.

Placed into a static quad/octree when the level is built.
21
Dynamic -> Static Collisions
Use the static quad/octree, and move down the tree to find the leaf nodes that it may be overlapping with.

Large performance speed up
22
Sleeping Objects
Dynamic objects that aren't moving (speed = 0). Ignored in collision detection against each other.

Awoken when speed > 0
Study all 22 cards for free