filmov
tv
Line vs Box2D AKA Raycasting | Coding a 2D Physics Engine in Java #7

Показать описание
In this tutorial, I explain how to check if a line is intersecting with a box. The way that I accomplish this is using a raycasting techinque (you could achieve the same result using variants of clipping algorithms). I extensively explain the mathematics behind this, going over a concrete example of how the raycast works. I explain how we can use the minimum and maximum of an AABB (2D box) to figure out the entry point and exit point of an intersecting line. Then, we implement the method. I also go over how to extend this functionality to check if a line is intersecting with an OBB (2D rotated box).
0:00 Intro
0:32 Math behind line vs box
15:38 Coding line vs box method
---------------------------------------------------------------------
Here are some books I recommend if you want to learn about game engine development more thoroughly. I do not profit off any of these sales, these are just some books that have helped me out :)
My Recommended Game Engine Books:
My Recommended Beginning Game Programming Books:
My Recommended Java Books:
Комментарии