diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/ray_box_cells/main.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/ray_box_cells/main.lua b/examples/ray_box_cells/main.lua index 9c7e54f..77aa058 100644 --- a/examples/ray_box_cells/main.lua +++ b/examples/ray_box_cells/main.lua @@ -16,6 +16,7 @@ local drawCellSize = cellSize:clone() local ray = nil local rayCol = nil local cells = {} +local exitPoint = {} local guiMouseHover = false local spinnerEdit = { @@ -64,7 +65,7 @@ function RL.update( delta ) ray = RL.GetMouseRay( RL.GetMousePosition(), camera.camera ) rayCol = box:getRayCollision( ray ) - cells = RL.GetRayBoxCells( ray, box:maxToPos(), cellSize ) + cells, exitPoint = RL.GetRayBoxCells( ray, box:maxToPos(), cellSize ) drawCellSize:setV( cellSize ) end end @@ -95,11 +96,12 @@ function RL.draw() RL.DrawRay( ray, RL.BLUE ) RL.DrawSphere( ray[1], 0.1, RL.GREEN ) end - if rayCol and rayCol.hit then RL.DrawSphere( rayCol.point, 0.1, RL.RED ) end - + if exitPoint.hit then + RL.DrawSphere( exitPoint.point, 0.1, RL.RED ) + end if cells then for _, cell in ipairs( cells ) do RL.DrawCubeWires( box.min + Vector3:tempT( cell ) * drawCellSize + drawCellSize:scale( 0.5 ), drawCellSize, RL.RED ) |
