Skip to content

rockclimber147/Java_Simple_Raycasting_Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java_Simple_Raycasting_Engine

Description

I made this raycasting engine using Java Swing. I wanted to have an interactable demo that could be used to explore the concepts used to generate raycasted 2.5D graphics. The bottom left panel shows a top down view of the player. The top panel shows what the player 'sees', based on their position and settings in the bttom right panel.

Usage

Run the main method to get started.

Settings Panel

Raycount slider changes the amount of rays that are cast from the player

FOV slider changes the minimum and maximum angles the rays are cast at, relative to the player

Scale factor slider scales the heights of the rendered rectangles on the top view

Color factor slider changes the rate at which rendered rectangles turn dark with increasing distance

Top Down View

Keyboard input moves player relative to the direction they are facing: W - forward

S - backward

A - strafe left

D - strafe right

Q - rotate left

E - rotate right

Rays are drawn as yellow according to the slider configuration, example (rayCount 50, FOV 90):

image

Player 'view'

Rectangles are drawn from left to right, each corresponding to a ray emitted by the player and render based on the color of the target, length of the ray, and scale sliders.

All together, it gives the illusion of travelling in 3d space!

_2024-01-11 22-39-34

About

A simple raycasting engine I made as a fun project to pass the time between courses

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages