This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSON_BUILDER = {} | |
JSON_BUILDER.BasePath = "./server/generated/" | |
JSON_BUILDER.PathCache = {} | |
function JSON_BUILDER.LoadFile(name) | |
local data = {} | |
local loadFile = LoadResourceFile(GetCurrentResourceName(), JSON_BUILDER.BasePath..name) | |
if loadFile ~= nil then | |
data = json.decode(loadFile) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- usage: local hit, endCoords, surfaceNormal, entityHit, entityType, direction = ScreenToWorld(flags, toIgnore) | |
function ScreenToWorld(flags, toIgnore) | |
local camRot = GetGameplayCamRot(0) | |
local camPos = GetGameplayCamCoord() | |
local posX = GetControlNormal(0, 239) | |
local posY = GetControlNormal(0, 240) | |
local cursor = vector2(posX, posY) | |
local cam3DPos, forwardDir = ScreenRelToWorld(camPos, camRot, cursor) | |
local direction = camPos + forwardDir * raycastLength |