3d линия

select1k

Активный
Автор темы
188
26
Версия MoonLoader
.026-beta
Привет как исправить проблему на Lua. При повороте камеры или движении моего скина пропадает линия и появляется при другом ракурсе как можно пофиксить?
lua:
          if airported.v then
                for i = 1, #airport do
                    if  airport[i] ~= nil
                    and airport[i+1] ~= nil
                    and isPointOnScreen(airport[i].x, airport[i].y,airport[i].z, 0)
                    and isPointOnScreen(airport[i+1].x, airport[i+1].y,airport[i+1].z, 0)
                    then
                        local col = col
                        if rainbowc.v then
                            local r,g,b,a = (mode.v == 0 and rainbow or rainbow_v2)(trailspeed.v, 255, (i+(mode.v == 1 and trailoffset.v or 0)) / -50)
                            local alpha = trailalpha.v == 256 and i*(255/(#airport > 255 and 255 or #airport)) or trailalpha.v
                            col = join_argb(alpha > 255 and 255 or alpha,r,g,b)
                        end
                        local x,y = convert3DCoordsToScreen(airport[i].x, airport[i].y,airport[i].z)
                        local x1,y1 = convert3DCoordsToScreen(airport[i+1].x, airport[i+1].y,airport[i+1].z)
                        local myx, myy, myz = getCharCoordinates(PLAYER_PED)
                        local disline = getDistanceBetweenCoords2d(myx, myy, airport[i].x, airport[i].y)
                        if disline < distancedraw.v then
                            renderDrawLine(x,y,x1,y1,width.v,col)
                        end
                    end
                end
            end

2022-06-16-193403668.png

2022-06-16-193525450.png
 

Yuriy Code

Известный
754
928
Привет, перед тем, как начать рендерить линию, сначала можно проверить, находятся ли координаты у тебя на экране.
Функция isPointOnScreen.

Использовать вот так:
Lua:
if isPointOnScreen(x, y, z) then
-- Если координаты есть на экране, здесь рендер линии
end