Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDA vMapCheck truncation only works in positive axis #82

Open
BlodgettBenjamin opened this issue May 23, 2023 · 0 comments
Open

DDA vMapCheck truncation only works in positive axis #82

BlodgettBenjamin opened this issue May 23, 2023 · 0 comments

Comments

@BlodgettBenjamin
Copy link

On line 107:
https://github.com/OneLoneCoder/Javidx9/tree/master/PixelGameEngine/SmallerProjects/OneLoneCoder_PGE_RayCastDDA.cpp

vRayStart is truncated from an olc::vf2d to an olc::vi2d. This works fine in the positive x and y axis, but will lead to issues otherwise. I think a comment should be left to note that the truncation will lead to issues. A component-wise flooring will work as intended for negative values.

here is an example of what will go wrong:
dda_issue
I adapted the olc implementation for 3D, in my voxel game. You can see the perspective camera is not situated in the positive xyz axis, and aiming roughly down the xy plane will lead to an inaccurate selection or no selection returned at all.

here is the same example but using a component-wise flooring instead:
dda_floor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant