Raycasting

Started by
-1 comments, last by emprog 18 years, 10 months ago
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.

This topic is closed to new replies.

Advertisement