Jump to content

LLIEPLLIEHb

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by LLIEPLLIEHb

  1. Thank you very much for your knowledge. I applied your code and it really works flawlessly. But I made a fatal mistake on my part - by the fact that I need to get coordinates relative to the listener itself, and not the sound source. I'll attach the video below. where is the relative calculation from the sound source In the future I will redo and make the correct calculations
  2. Greetings, programmers. Faced with an incomprehensible task for me. The essence is this - you need to find the x,y,z coordinate of the listener's point on the sound source, but the listener's coordinate does not belong to the vector of the sound source. Simply put, we need the relative coordinates of the listener from the point of the sound source, taking into account rotation (sound.rotZ) Example: an example of what I mean addEventHandler("onClientRender",root,function() listener = { fullPosition = localPlayer.matrix:getPosition(), matrix = localPlayer.matrix, player = localPlayer, x = localPlayer.matrix:getPosition().x, y = localPlayer.matrix:getPosition().y, z = localPlayer.matrix:getPosition().z, rotZ = localPlayer.matrix:getRotation().z, distance = 1.5, } --{x,y,z,rotZ} end) local sound = { x =-1788.82507, y=-2689.26538, z=4.26150, vector3 = Vector3(-1788.82507,-2689.26538,4.26150), rotZ =180+90, distance = 3.5 } addEventHandler("onClientRender",root,function() martNewPos = { soundRotate = math.ceil(sound.rotZ), Pos = {x = 0, y = 0,z = 0} -- как тут найти позицию слушателя на векторе источника звука при этом учитывая rotZ источника звука } local dist = getDistanceBetweenPoints2D ( sound.x,sound.y,listener.x,listener.y ) -- дистанция между двумя точками local coords = { getScreenFromWorldPosition ( listener.x,listener.y,listener.z ) } if coords[1] and coords[2] then dxDrawText ("\n"..inspect(martNewPos), coords[1], coords[2], coords[1], coords[2], tocolor(255,255,255), 2, "unifont" ) end end) addEventHandler("onClientRender",root,function() -- рендер графики точки звука local coords = { getScreenFromWorldPosition ( sound.x,sound.y,sound.z ) } if coords[1] and coords[2] then dxDrawText ( "Источник звука", coords[1], coords[2], coords[1], coords[2], tocolor(255,255,255), 2, "unifont" ) end local vehicleUpwardsVector, vehicleForwardVector = listener.matrix:getUp(), listener.matrix:getForward() local crossVector = {Vector3(0,0,0)} dxDrawLine3D(sound.vector3, sound.x-math.sin(math.rad(sound.rotZ))*sound.distance,sound.y+math.cos(math.rad(sound.rotZ))*sound.distance,sound.z, tocolor(255, 0, 0)) local sx, sy = getScreenFromWorldPosition(sound.x-math.sin(math.rad(sound.rotZ))*sound.distance,sound.y+math.cos(math.rad(sound.rotZ))*sound.distance,sound.z) if sx then dxDrawText("Z", sx, sy) end local vehicleUpwardsVectorPoint = sound.vector3 + vehicleUpwardsVector*sound.distance dxDrawLine3D(sound.vector3, vehicleUpwardsVectorPoint, tocolor(0, 255, 0)) local sx, sy = getScreenFromWorldPosition(vehicleUpwardsVectorPoint) if sx then dxDrawText("Y", sx, sy) end dxDrawLine3D(sound.vector3, sound.x-math.sin(math.rad(sound.rotZ-90))*sound.distance,sound.y+math.cos(math.rad(sound.rotZ-90))*sound.distance,sound.z, tocolor(0, 0, 255)) local sx, sy = getScreenFromWorldPosition(sound.x-math.sin(math.rad(sound.rotZ-90))*sound.distance,sound.y+math.cos(math.rad(sound.rotZ-90))*sound.distance,sound.z) if sx then dxDrawText("X", sx, sy) end end) addEventHandler("onClientRender",root,function() -- рендер графики точки Слушателя local coords = { getScreenFromWorldPosition ( listener.x,listener.y,listener.z ) } if coords[1] and coords[2] then dxDrawText ( "Слушатель", coords[1], coords[2], coords[1], coords[2], tocolor(255,255,255), 2, "unifont" ) end local vehicleUpwardsVector, vehicleForwardVector = listener.matrix:getUp(), listener.matrix:getForward() local crossVector = vehicleForwardVector:cross(vehicleUpwardsVector):getNormalized() dxDrawLine3D(listener.fullPosition, listener.x-math.sin(math.rad(listener.rotZ))*listener.distance,listener.y+math.cos(math.rad(listener.rotZ))*listener.distance,listener.z, tocolor(255, 0, 0)) local sx, sy = getScreenFromWorldPosition(listener.x-math.sin(math.rad(listener.rotZ))*listener.distance,listener.y+math.cos(math.rad(listener.rotZ))*listener.distance,listener.z) if sx then dxDrawText("Z", sx, sy) end local vehicleUpwardsVectorPoint = listener.fullPosition + vehicleUpwardsVector*listener.distance dxDrawLine3D(listener.fullPosition, vehicleUpwardsVectorPoint, tocolor(0, 255, 0)) local sx, sy = getScreenFromWorldPosition(vehicleUpwardsVectorPoint) if sx then dxDrawText("Y", sx, sy) end dxDrawLine3D(listener.fullPosition, listener.x-math.sin(math.rad(listener.rotZ-90))*listener.distance,listener.y+math.cos(math.rad(listener.rotZ-90))*listener.distance,listener.z, tocolor(0, 0, 255)) local sx, sy = getScreenFromWorldPosition(listener.x-math.sin(math.rad(listener.rotZ-90))*listener.distance,listener.y+math.cos(math.rad(listener.rotZ-90))*listener.distance,listener.z) if sx then dxDrawText("X", sx, sy) end end) -- setTimer ( function() -- вращение источника звука -- if sound.rotZ >= 360 then -- sound.rotZ = 0 -- end -- sound.rotZ = sound.rotZ+.25 -- end, 1, 0 )
  3. what could be the problem? The local server is starting And the server is not compiled OS - Linux Ubuntu 22.04
  4. Returns a static value after restarting
  5. local points = {{0,0},{1,7},{7,7},{15,7},{30,30},{7,14},{14,14},{25,25},{25,18},{20,18},{10,25}} local p1x,p1y = points[1][1],points[1][2] local p2x,p2y = points[5][1],points[5][2] local orig = getDistanceBetweenPoints2D ( p1x,p1y,p2x,p2y ) local analog = math.sqrt((p2x - p1x) * (p2x - p1x) + (p2y - p1y) * (p2y - p1y)) iprint("original-", orig) iprint("analog-", analog) Debug Script 3
  6. I managed to fix the error by installing ncurses5-compat-libs 6.2-1 from the AUR repository
  7. Hello faced with such a problem I use Linux Manjaro KDE Plasma from 12/14/2021 I tried to install the necessary libraries , some of them were installed and the other was not used (sudo pacman -S libncurses5-dev libncursesw5-dev ) And says that the package was not found ------ sudo pacman ------------------------- mistake: target not found: libncurses5-dev mistake: target not found: libncursesw5-dev --------------------- Error Compiling------------------------------------------------------ /usr/bin/ld: cannot be found -l:libncursesw.so.5 collect2: error: ld execution ended with return code 1 make[1]: *** [Core.make:208: ../Bin/server/x64/core.so] Error 1 make: *** [Makefile:161: Core] Error 2 make: exit from the directory "/home/skynet/Downloads/mtasa-blue-master/Build" --------------------- Error Compiling------------------------------------------------------
  8. There is such a function dxCreateRenderTarget Which creates a square\rectangular target depending on the parameters of the function, the essence of the question is - Is there any way to implement a rendertarget with rounded edges or make it in the form of a circle?
×
×
  • Create New...