Guest User

Lines can't seen with some angle

a guest
Aug 17th, 2011
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. localPlayer=getLocalPlayer()
  2. local color = tocolor(255,0,255,255)
  3. function getPositionInFrontOfElement(element,x,y,z)
  4.     -- Get the matrix
  5.     local matrix =  getElementMatrix ( element )
  6.     -- Get the transformation of a point 5 units in front of the element
  7.     local offX = x * matrix[1][1] + y * matrix[2][1] + z * matrix[3][1] + matrix[4][1]
  8.     local offY = x * matrix[1][2] + y * matrix[2][2] + z * matrix[3][2] + matrix[4][2]
  9.     local offZ = x * matrix[1][3] + y * matrix[2][3] + z * matrix[3][3] + matrix[4][3]
  10.     --Return the transformed point
  11.     return offX, offY, offZ
  12. end
  13.  
  14. addEventHandler("onClientPreRender",getRootElement(),function(timeslice)
  15.     local x1,y1,z1 = getPositionInFrontOfElement(localPlayer,6,-6,0)
  16.     local x2,y2,z2 = getPositionInFrontOfElement(localPlayer,6,6,0)
  17.     local x3,y3,z3 = getPositionInFrontOfElement(localPlayer,-6,-6,0)
  18.     local x4,y4,z4 = getPositionInFrontOfElement(localPlayer,-6,6,0)
  19.     local xx,yy,zz = getElementPosition(localPlayer)
  20.     z1 = getGroundPosition(x1,y1,z1)+1
  21.     z2 = getGroundPosition(x2,y2,z2)+1
  22.     z3 = getGroundPosition(x3,y3,z3)+1
  23.     z4 = getGroundPosition(x4,y4,z4)+1
  24.     dxDrawLine3D(x1,y1,z1,x2,y2,z2,color,10,1,1,1)
  25.     dxDrawLine3D(x2,y2,z2,x4,y4,z4,color,10,1,1,1)
  26.     dxDrawLine3D(x3,y3,z3,x1,y1,z1,color,10,1,1,1)
  27.     dxDrawLine3D(x4,y4,z4,x3,y3,z3,color,10,1,1,1)
  28. end)
RAW Paste Data