3d > 2d

Vespan

loneliness
Автор темы
Проверенный
2,137
1,860
Версия MoonLoader
.026-beta
почему isPointOnScreen нихуя не работает,какой радиус не ставлю все равно хуево работает.3Д Координаты не на экране но все равно isPointOnScreen считает что я их вижу(каво) и 2Д линии рендеряться не там где надо.
 
Решение
Тоже как-то ебался с этим, в итоге обошёлся без isPointOnScreen
Вот ВРОДЕ рабочий вариант (вырезка из кода)
Lua:
      local px, py, pz = getCharCoordinates(PLAYER_PED)
      local _, spos_pl_x, spos_pl_y = convert3DCoordsToScreenEx(px, py, pz)

      local char_result, char = sampGetCharHandleBySampPlayerId(subject.id)
      if tracker_autoremove_active and not char_result then
         tracker_subjects[key] = nil
         printChat("Player #%i has exited stream and was removed", subject.id)
         goto continue2
      end

      local clr_circle, clr_line = DRAWCOLOR_OUTSTREAM_CIRCLE, DRAWCOLOR_OUTSTREAM_LINE
      if char_result then
         local lpos_x, lpos_y, lpos_z = subject.last_position:get()
         subject.last_position =...

RedHolms

Известный
Проверенный
621
382
Тоже как-то ебался с этим, в итоге обошёлся без isPointOnScreen
Вот ВРОДЕ рабочий вариант (вырезка из кода)
Lua:
      local px, py, pz = getCharCoordinates(PLAYER_PED)
      local _, spos_pl_x, spos_pl_y = convert3DCoordsToScreenEx(px, py, pz)

      local char_result, char = sampGetCharHandleBySampPlayerId(subject.id)
      if tracker_autoremove_active and not char_result then
         tracker_subjects[key] = nil
         printChat("Player #%i has exited stream and was removed", subject.id)
         goto continue2
      end

      local clr_circle, clr_line = DRAWCOLOR_OUTSTREAM_CIRCLE, DRAWCOLOR_OUTSTREAM_LINE
      if char_result then
         local lpos_x, lpos_y, lpos_z = subject.last_position:get()
         subject.last_position = vec3(getCharCoordinates(char))
         local frame_move_dist = getDistanceBetweenCoords3d(lpos_x, lpos_y, lpos_z, subject.last_position:get())
         if frame_move_dist >= MIN_TELEPORT_DISTANCE then
            subject.teleport = {
               from={x=lpos_x, y=lpos_y, z=lpos_z},
               to={x=subject.last_position.x, y=subject.last_position.y, z=subject.last_position.z}
            }
         end
         clr_circle = DRAWCOLOR_INSTREAM_CIRCLE
         clr_line = DRAWCOLOR_INSTREAM_LINE
      end
      
      local coord_result, spos_subj_x, spos_subj_y, spos_subj_z = convert3DCoordsToScreenEx(subject.last_position:get())
      local pname = sampGetPlayerNickname(subject.id)
      if coord_result and spos_subj_z > 0 then
         local subj_dist = getDistanceBetweenCoords3d(px, py, pz, subject.last_position:get())

         renderDrawLine(spos_pl_x, spos_pl_y, spos_subj_x, spos_subj_y, 1, clr_line)
         renderDrawCircle(spos_subj_x, spos_subj_y, 10, 0, clr_circle)
         renderFontDrawText(draw_font,
            ("%s (%i). Distance: %s\n%s"):format(pname, subject.id, tostring(subj_dist), char_result and "" or "{f7ef00}Not in stream"),
            spos_subj_x, spos_subj_y + 15,
            0xFFFFFFFF
         )
      end
 
  • Вау
Реакции: qdIbp