From 9df2e065b4a60e7caa4a934e62c65c2213dcfde5 Mon Sep 17 00:00:00 2001 From: Matthew <22198949+MafewTM@users.noreply.github.com> Date: Tue, 22 Oct 2024 00:12:34 -0400 Subject: [PATCH] fix(client/main): using camera --- client/main.lua | 12 +++++++----- config/client.lua | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/main.lua b/client/main.lua index 5429e01..71b8857 100644 --- a/client/main.lua +++ b/client/main.lua @@ -102,12 +102,14 @@ local function rotAnglesToVec(rot) -- input vector3 end local function getVehicleInView(cam) - local coords = GetCamCoord(cam) - local forwardVector = coords + (rotAnglesToVec(GetCamRot(cam, 2)) * 400.0) - --DrawLine(coords, coords + (forward_vector * 100.0), 255, 0, 0, 255) -- debug line to show LOS of cam - local rayHandle = CastRayPointToPoint(coords.x, coords.y, coords.z, forwardVector.x, forwardVector.y, forwardVector.z, 10, cache.vehicle, 0) + local camCoords = GetCamCoord(cam) + local camRot = GetCamRot(cam, 2) + local forwardVector = rotAnglesToVec(camRot) + local targetCoords = camCoords + (forwardVector * 400.0) + local rayHandle = CastRayPointToPoint(camCoords.x, camCoords.y, camCoords.z, targetCoords.x, targetCoords.y, targetCoords.z, 10, cache.vehicle, 0) local _, _, _, _, entityHit = GetRaycastResult(rayHandle) - return entityHit <= 0 and nil or IsEntityAVehicle(entityHit) and entityHit + + return entityHit > 0 and IsEntityAVehicle(entityHit) and entityHit or nil end local function renderVehicleInfo(vehicle) diff --git a/config/client.lua b/config/client.lua index e69de29..1040184 100644 --- a/config/client.lua +++ b/config/client.lua @@ -0,0 +1,3 @@ +return { + policeHelicopter = 'polmav', +} \ No newline at end of file