mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-17 17:08:39 +00:00
Line_of_sight: Improve using VoxelLineIterator
This commit rewrites line_of_sight with VoxelLineIterator. Stepsize is no longer needed, the results will be always accurate.
This commit is contained in:
parent
ca64f564cd
commit
2153965cf9
5 changed files with 27 additions and 35 deletions
|
@ -328,8 +328,15 @@ public:
|
|||
// This makes stuff happen
|
||||
void step(f32 dtime);
|
||||
|
||||
//check if there's a line of sight between two positions
|
||||
bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL);
|
||||
/*!
|
||||
* Returns false if the given line intersects with a
|
||||
* non-air node, true otherwise.
|
||||
* \param pos1 start of the line
|
||||
* \param pos2 end of the line
|
||||
* \param p output, position of the first non-air node
|
||||
* the line intersects
|
||||
*/
|
||||
bool line_of_sight(v3f pos1, v3f pos2, v3s16 *p = NULL);
|
||||
|
||||
u32 getGameTime() const { return m_game_time; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue