Sign in to follow this  
erickmeister

Can someone tell me if I am turning correctly?

Recommended Posts

erickmeister    122
When the right arrow or left arrow key is pressed in my raycaster I am either -=1.0f or +=1.0f to my directional float. Each time the player moves the rays to be casted are pre-calculated in an array so there is no need to increment a ray angle each ray casting loop iteration. Does this seem ok? I found out why I had a problem with my raycaster. I was searching for walls on a grid size basis (64 units) without checking intersections. I read a small tutorial on checking for vertical/horizontal intersections but I still cannot get it. My attempts make the end result look a little better but still not right. I am confused because some people say you only have to check for the H/V grid bounds ONCE, then go on and increment by the size of the grids while others say you always have to check for each V/H grid bounds as you go which both show their own code ideas. Can someone please tell me the correct and only way raycasting should be done? What I have so far... 1: calculate all ray angles (I know this is correct) 2: cast rays (very off) 3: draw wall slices (i'm sure this is correct) 4: show to screen in main game loop (very much correct) Erick

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