Skip to content
Snippets Groups Projects

Fix collision detection in 02-jumping-boxes

Merged Jonas Johan Solsvik requested to merge develop-jonas into master
4 files
+ 175
305
Compare changes
  • Side-by-side
  • Inline

Files

+ 51
0
# Devlog 03.09.2020 - 15:00
## Collision resolving @ gamedev stackexchange
https://gamedev.stackexchange.com/a/71123
```
Instead of using the above method, you resolve collision like so:
Move the player along the X axis.
Check for colliding tiles.
Resolve X collision.
Move the player along the Y axis.
Check for colliding tiles.
Resolve Y collision.
```
## Narrow phase collision detection
Computationally, it is desirable that all shapes are convex in a simulation, since we have a lot of powerful distance and intersection test algorithms that work with convex shapes.
## SAT - Separating axis theorem
The separating axis theorem (SAT) states that two convex shapes are not intersecting if and only if there exists at least one axis where the orthogonal projections of the shapes on this axis do not intersect.
## And more...
- If, for any edge, all vertices of the other polygon are in front of it – then the polygons do not intersect.
- Linear algebra provides an easy formula for this test: given an edge on the first shape with vertices a and b and a vertex v on the other shape, if (v - a) · n is greater than zero, then the vertex is in front of the edge.
- The Expanding Polytope Algorithm (EPA) allows us to obtain that information, starting where GJK left off: with a simplex that contains the origin.
# Devlog 03.09.2020 - 12:00
I found a great article!
@see https://www.toptal.com/game/video-game-physics-part-ii-collision-detection-for-solid-objects
## Newtons three laws of motion
- Inertia: If no force is applied on an object, its velocity (speed and direction of motion) shall not change.
- Force, Mass, and Acceleration: The force acting on an object is equal to the mass of the object multiplied by its acceleration (rate of change of velocity). This is given by the formula F = ma.
- Action and Reaction: “For every action there is an equal and opposite reaction.” In other words, whenever one body exerts a force on another, the second body exerts a force of the same magnitude and opposite direction on the first.
## axis-aligned bounding boxes (AABB)
To test if two AABBs intersect, we only have to find out if their projections intersect on all of the coordinate axes:
# Devlog 03.09.2020 - 09:00
- I am hitting a wall with my hacky off-the-top-of-my-head collision implementation. Time to study som literarture
\ No newline at end of file
Loading