Week 4 - Tracelines and Bounding Boxes

Channel:
Subscribers:
2,640
Published on ● Video Link: https://www.youtube.com/watch?v=aW35tyck8Jc



Duration: 1:31:09
25 views
0


Today we went over the Edgelord code a bit since not a lot of students did it.


We then moved on to a really critical topic, which is the use of rectangles and bounding boxes in games. Rectangles (especially axis-aligned rectangles) are really, really easy to see if a point is within them, and fairly easy (though you have to think back to 7th grade Algebra) to see if a line intersects them. Because it's really easy to see if a line hits a rectangle, you can wrap a complex object in a bounding box to do a quick test to see if the line misses the object entirely, and if it does hit the bounding box, do a more expensive collision test if you like.


Since it can be really expensive to test a line against all the objects in your world, it's important to use a data structure to hold the objects in your world. So we talked BSPs (Binary Space Partitions, with a brief mention of K-d trees), quadtrees, grids, and BVHs. Each has their benefits and tradeoffs, with the ultimate goal of having to only test a handful of collisions in a world with potentially millions of objects in it.







Tags:
is50b
game development
bsp
bvh
traceline
linetrace