How do I do collision detection between the player and an obstacle / pickup?
are many techniques for collision detection.
In this module, my advice is to keep
it simple. The
simplest form of collision detection: glm::length()
the distance between two objects is below a threshold T, register a collision.
< T) //
requires that you know p
. If you have a large number of obstacles /
pickups, store them in an std::vector
. Then, when performing collision detection
apply the above algorithm for each object q
with the player p
natural place in the template code to do collision detection is Game::Update().