Games Raycasting Algorithm Demo - Work In Progress

wonder

Expert
Licensed User
Longtime User
I almost had a brain meltdown porting this into B4x... :)

rays.PNG

So far it appear to work as expected... Give it a try. :)

Controls:
[Left-Click] Draw blocks
[Right-Click] Activate raycasting
[Right-Drag] Move light source

Note: Casting from inside a block looks broken, but it's an intentional speed-up.
 

Attachments

  • raycaster.jar
    323.2 KB · Views: 498

ilan

Expert
Licensed User
Longtime User
nice, if you want to simulate a grenade explosion then you can use it to see where is a wall and no force will go through it so if a player stand behind that wall he wont get hit by the grenade only who is in the range of the yellow lines.
 

melonZgz

Active Member
Licensed User
Longtime User
And if you use Box2D you have the awesome box2DLights, with raycasting, light type, shadows...
(C'mon @wonder , you know that someday you'll try box2d)