So i’m working on a few scripts, and could easily get vehicles located in front of me with CastRayPointToPoint, but how do I now flip this to get the vehicle located behind me?
I’m using this function I found around the forums, but am a tad bit confused. Thanks in advance for any help supplied.
function getVehicleInDirection(coordFrom, coordTo)
local rayHandle = CastRayPointToPoint(coordFrom.x, coordFrom.y, coordFrom.z, coordTo.x, coordTo.y, coordTo.z, 10, GetPlayerPed(-1), 0)
local a, b, c, d, vehicle = GetRaycastResult(rayHandle)
return vehicle
end