Report as inappropriate.
This is a demo of my raycasting algorithm. It is very fast (demo runs on my laptop at ~3000 fps) and completly reusable. It allows specification of start, direction, maximum distance, target class, ignored actors and more!
-- Updated to work with Java 8 --
The algorithm works by generating the edges of each actor, removing the ones facing away from the ray and mathmatically calculating if the ray intersects each edge. This is more precise and much quicker than walking step-by-step through the world checking for intersection with each actor on every frame. It is also not neccecarily limited in distance: The collision check of an actor a million units away takes just as the one for one 1 unit away.
For additional performance all generated edges are cached meaning that non-moving actors will be even more performant.
Use in games I could think of would be for example sensors off all kinds, weather you want to simulate a light gate or want to use ai to manouver a car around a track, Also, this can be interesting when simulating vision range. Additionally it can be helpful simply for checking if there is something in the way between two objects.
Use the arrow keys to move around. The visualization is also included and reusable, but not at all neccecary!
2464 views / 766 in the last 7 days
11 votes | 1 in the last 7 days
This scenario is a member of: Reusable classes