Closed Ruixel closed 4 years ago
i think i know what's causing the bug. it's because of the raycast taking fixed-size steps, causing the ray to potentially miss the edges of blocks. i scribbled a diagram below to better illustrate this: you probably could just decrease the step size, but it would be a lot more efficient to instead step to the next grid plane on the voxel grid.
That's a pretty solid explanation and suggestion. Feel free to assign yourself if you want to fix it, if not I could have a go implementing your suggestion.
oh, yes, please feel free to give it a go yourself. i'm not sure if i can make a reasonably efficient implementation of it myself
Bug has been fixed. https://github.com/Hopson97/open-builder/pull/125
Bug Name
Ray inaccuracy when breaking/placing blocks
Describe the bug
When a user points their camera to the edge of a block, sometimes the ray goes past it and chooses the block behind it. This is most obvious with the new selection box feature, and can cause flickering when picking between the two.
To Reproduce
Clone and compile, find a block nearby and move your cursor to the edges of the blocks.
Expected behavior
The block in-front of the camera should be highlighted, yet it's not. 🤔
Screenshots
https://imgur.com/a/LmxHNIW
Desktop (please complete the following information):
Windows, compiled with VS
Additional context
none