Sign in to follow this  
emprog

Raycasting

Recommended Posts

I have a problem implementing a tutorial (permadi) which I am sure most of you have read. If I start the player off at say 90* facing north. Before I subtract the 30* degrees for doing the ray sweep (60* field of view) I would subtract SCREEN_WIDTH/FOV * 30 correct? And this will be the first angle casted? Then all I basically need to do is: //until ray hits a wall ray_x += vector * cos(angle * M_PI/180); ray_y += vector * sin(angle * M_PI/180); //increment ray by SCREEN_WIDTH/FOV? If this is correct I have another question. I have seen some tutorials which use lookup tables with predefined angles (integers) Can somsone please explain this technique to me? I'm trying to get a simple non-textured raycaster done but i'm stuck on the raycsating step. I get horrible results when I run the program.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this