Update init.lua
This commit is contained in:
parent
368b0c1a77
commit
29be312612
1 changed files with 14 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
||||||
--!strict
|
--!strict
|
||||||
|
|
||||||
local Util = {
|
local Util = {
|
||||||
|
TruncateRaycasts = true,
|
||||||
GlobalTimer = 0,
|
GlobalTimer = 0,
|
||||||
Scale = 1 / 16,
|
Scale = 1 / 16,
|
||||||
}
|
}
|
||||||
|
@ -103,18 +104,22 @@ function Util.RaycastSM64(pos: Vector3, dir: Vector3, rayParams: RaycastParams?,
|
||||||
end
|
end
|
||||||
|
|
||||||
function Util.FindFloor(pos: Vector3): (number, RaycastResult?)
|
function Util.FindFloor(pos: Vector3): (number, RaycastResult?)
|
||||||
|
local newPos = pos
|
||||||
|
|
||||||
|
if Util.TruncateRaycasts then
|
||||||
local trunc = Vector3int16.new(pos.X, pos.Y, pos.Z)
|
local trunc = Vector3int16.new(pos.X, pos.Y, pos.Z)
|
||||||
local height = -11000
|
|
||||||
|
|
||||||
if math.abs(trunc.X) >= 0x2000 then
|
if math.abs(trunc.X) >= 0x2000 then
|
||||||
return height, nil
|
return -11000, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if math.abs(trunc.Z) >= 0x2000 then
|
if math.abs(trunc.Z) >= 0x2000 then
|
||||||
return height, nil
|
return -11000, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
newPos = Vector3.new(trunc.X, trunc.Y, trunc.Z)
|
||||||
end
|
end
|
||||||
|
|
||||||
local newPos = Vector3.new(trunc.X, trunc.Y, trunc.Z)
|
|
||||||
local result = Util.RaycastSM64(newPos + (Vector3.yAxis * 100), -Vector3.yAxis * 10000)
|
local result = Util.RaycastSM64(newPos + (Vector3.yAxis * 100), -Vector3.yAxis * 10000)
|
||||||
|
|
||||||
if result then
|
if result then
|
||||||
|
|
Loading…
Reference in a new issue