Jump to content

[PLEASE HELP]dxDrawMaterialLine3D and dxDrawText


Recommended Posts

Anyone help me ?

My code;

local minX = 2

tex = dxCreateTexture("texture.png")

function test3DGUI()
minX = getElementBoundingBox(localPlayer)
x,y,z,lx,ly,lz,x2,y2,z2 = getPositionFromElementOffset(minX-1,0,minX+0.5,1)
dxDrawMaterialLine3D(x2,y2,z2+0.5,x,y,z+0.5, tex, 1, tocolor(0,0,0,150),lx,ly,lz)
dxDrawMaterialLine3D(x2,y2,z2+0.5,x,y,z2+0.32, tex, 1, tocolor(255,0,29,255),lx,ly,lz)
local sx,sy = getScreenFromWorldPosition ( x2,y2,z2, 0 ) 
dxDrawText ( "3D text", sx, sy - 30, sx, sy - 30, tocolor(255,255,255,255), 1, "bankgothic", "center", "bottom", false, false, false ) 
end
addEventHandler("onClientRender", root, test3DGUI)

function getPositionFromElementOffset(offX,offY,offX2,offY2)
	local offZ = -0.5
	local m = getElementMatrix ( localPlayer )
	local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1]  
	local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2]
	local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3]
	
	local x2 = offX2 * m[1][1] + offY2 * m[2][1] + offZ * m[3][1] + m[4][1] 
	local y2 = offX2 * m[1][2] + offY2 * m[2][2] + offZ * m[3][2] + m[4][2]
	local z2 = offX2 * m[1][3] + offY2 * m[2][3] + offZ * m[3][3] + m[4][3]
	
	offZ = 0.5
	local x3 = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] 
	local y3 = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2]
	local z3 = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3]
	
	return x, y, z, x2, y2, z2, x3, y3, z3    
end

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...