Jump to content
  • Advertisement
Sign in to follow this  

Can someone tell me if I am turning correctly?

This topic is 4984 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!