Hey folks, 
I'm trying to draw 3D lines around various vehicles, using dxDrawLine3D. For now I'm just trying to draw a line in front of the vehicle. I'm using some basic trig, with the distances and angles hardcoded (and that's fine, I won't need to do it with many different types of vehicles). Here is what I have: 
 
addEventHandler("onClientRender", getRootElement(), function() 
        local veh = getPedOccupiedVehicle(getLocalPlayer()) 
        if (not veh) then 
            return 
        end 
        local vx, vy, vz = getElementPosition(veh) 
        local vrx, vry, vrz = getElementRotation(veh) 
         
        local a1 = 100 
        local a2 = 80 
        local dist = 2.5 
         
        local x1 = vx + math.cos((vrz + a1) * (math.pi / 180)) * dist 
        local y1 = vy + math.sin((vrz + a1) * (math.pi / 180)) * dist 
        local z1 = vz 
         
        local x2 = vx + math.cos((vrz + a2) * (math.pi / 180)) * dist 
        local y2 = vy + math.sin((vrz + a2) * (math.pi / 180)) * dist 
        local z2 = vz 
         
        dxDrawLine3D(x1, y1, z1, x2, y2, z2, 0xFFFF0000, 10) 
        dxDrawText(tostring(x) .. "\n" .. tostring(y) .. "\n" .. tostring(z) .. "\n" .. tostring(vrx) .. "\n" .. tostring(vry) .. "\n" .. tostring(vrz), 300, 0) 
    end 
) 
 
This works fine, and the line follows the vehicle's yaw and stays out front. My problem is with the z component of the line. I need to find a way to combine the pitch and the roll of the vehicle to get the line to stay perfectly in sync with the vehicle in whatever rotation it is. I can get either the pitch or roll to work, but can't for the life of me figure out how to combine the two. I basically need to get a 3D line to draw always between the two front headlights, following the vehicle rotation. 
 
Does anyone know how I can achieve that? 
Thanks.