Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 979 Bytes

File metadata and controls

20 lines (13 loc) · 979 Bytes

raycasting

Exploring raycasting to create 3d graphics in pygame.

Although the code is still being cleaned up, so far the program works like this: raycast

EXPLANATION:

Using a 2d image we can send out "rays" from an object in an angle we'll call the players field of vision (FOV). When these rays collide with 2d objects we can represent them as slivers of vertical rectangles with heights and color values based on the distance of the ray (smaller and darker if farther away). These slivers blend together to create the "3d" look.

REPRESENTATION:

show

Known issues: There is a slight curvature to objects, noticable when you look at them from an angle. They appear this way due to some math I implemented to fix shapes appearing like fishbowls.

Use WASD to move. Press Z to lock/unlock the mouse. While locked, move the mouse to rotate the player.