summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjussi2024-07-20 15:29:50 +0300
committerjussi2024-07-20 15:29:50 +0300
commitc6eb85b3674c36cfc426486d866a78dfc5452ae0 (patch)
tree2682f880b3254bf1901556da809f5475b2693ccc /examples
parent03e9226b5f6c3fe4d113759b3a023ee92d7b2d4f (diff)
downloadreilua-enhanced-c6eb85b3674c36cfc426486d866a78dfc5452ae0.tar.gz
reilua-enhanced-c6eb85b3674c36cfc426486d866a78dfc5452ae0.tar.bz2
reilua-enhanced-c6eb85b3674c36cfc426486d866a78dfc5452ae0.zip
GetRayBoxCells also returns exit point.
Diffstat (limited to 'examples')
-rw-r--r--examples/ray_box_cells/main.lua8
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 )