-
Notifications
You must be signed in to change notification settings - Fork 15
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
Raycast fn using fast traversal #25
Raycast fn using fast traversal #25
Conversation
+ Added `voxel_line_traversal` and `voxel_cartesian_traversal` for versatile and fast traversal of the voxel grid + Created a new bevy_voxel_world::traversal_alg module to make it easy for crate users to import those algorithms + Added VoxelFace enum to represent the face of a voxel, automatically imported by the prelude + Added VOXEL_SIZE constant (because I was uncomfortable implicitly using the fact that voxels are unit-sized) + Added an example showing how to use and debug voxel traces
Returns Err for VoxelFace::None, Ok for regular faces.
+ New get_bounds function on ChunkMap + Updating or removing chunks automatically updates the bounds
+ VoxelRaycastResult::normal is now an Option<Vec3>, which is None when the raycast result is the voxel from which the trace originated from
I've executed the benchmarks and the new algo is outperforming the old one by quite much. You can find the benchmark code on this branch if you want to see by yourself! To test, just checkout this branch and run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replacing the stepping algo with the fast traversal one makes perfect sense. Thank you for contributing this as well!
Good catch on the fixes you made ! And thanks for merging <3 |
I could successfully replace the step algorithm you were using by the new voxel line traversal for the same results. I leave this in draft though as this PR depends on the other to be approved first. Also, I'd like to do some benchmark to make sure the performance are equal or better.