Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
local headPos = GetPedBoneCoords(ped, 31086, 0.0, 0.0, 0.0)
local offsetPos = GetOffsetFromEntityInWorldCoords(ped, 0.0, 20.0, -10.0)
DrawLine(headPos.x, headPos.y, headPos.z, offsetPos.x, offsetPos.y, offsetPos.z, 255, 0, 0, 255)
local rayHandle = StartShapeTestRay(headPos.x, headPos.y, headPos.z, offsetPos.x, offsetPos.y, offsetPos.z, 32, ped, 7)
local result, hit, endCoords, surface, material, entity = GetShapeTestResultEx(rayHandle)
print("SURFACE: " .. material)
if hit then
DrawMarker(28, endCoords.x, endCoords.y, endCoords.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 0.2, 0.2, 0.2, 255, 128, 0, 50, false, true, 2, nil, nil, false)
end
end
end)
So I am trying to get the raycast to collide with water and water only…
but when it comes to the water?
flag (32) it doesn’t detect anything… but if I set the flag to say 1 it detects the other surfaces just fine.
This is what my debug stuff looks like when I have the flag set to 1.
When the flag is set to 32 (the water? flag) that line just goes through the water and collides with nothing.
Does anyone know if you can get raycasts to collide with water?