Jump to content

[Help] Marker Model


3B00DG4MER

Recommended Posts

Here is a function for you. Drawing circles in 3D world.

function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
        fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
        fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
        tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
        tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
        dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 

You can modify it to draw what you're showing on the picture easily. Haven't tested but I can't see any errors so it should work.

Link to comment
Here is a function for you. Drawing circles in 3D world.
function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
        fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
        fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
        tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
        tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
        dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 

You can modify it to draw what you're showing on the picture easily. Haven't tested but I can't see any errors so it should work.

i have understood only dxDrawCircle and color and dxDrawLine3D

Does it replace the Marker ?

Link to comment
Here is a function for you. Drawing circles in 3D world.
function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
        fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
        fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
        tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
        tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
        dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 

You can modify it to draw what you're showing on the picture easily. Haven't tested but I can't see any errors so it should work.

There is error,Which is radius is a nil value

and You haven't define it

Link to comment
radius is a parameter. You have to pass it when you call the function to determine how big the circle should be. Segments, color and width params are optional.

but it's won't work

        function dxDrawCircle3D( x,y,z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
        fX = 1603 + math.cos( math.rad( segAngle * i ) ) * radius; 
        fY = -1696.3896484375 + math.sin( math.rad( segAngle * i ) ) * radius; 
        tX = 1603 + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
        tY = -1696.3896484375 + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
        dxDrawLine3D( fX, fY, 5, tX, tY, 5, color, width ); 
    end 
end 
addEventHandler("onClientResourceStart",getRootElement(),dxDrawCircle3D) 
      

i have Edit X and y and Z,Should i edit them ?

Link to comment

Try it:

function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
    fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
    fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
    tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
    tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
    dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 
  
addEventHandler("onClientRender", root,  
    function() 
        dxDrawCircle3D( 1603, -1696.4, 5, 3) 
    end 
) 

Link to comment
Try it:
function dxDrawCircle3D( x, y, z, radius, segments, color, width ) 
    segments = segments or 16; -- circle is divided into segments -> higher number = smoother circle = more calculations 
    color = color or tocolor( 255, 255, 0 ); 
    width = width or 1; 
    local segAngle = 360 / segments; 
    local fX, fY, tX, tY; -- drawing line: from - to 
    for i = 1, segments do 
    fX = x + math.cos( math.rad( segAngle * i ) ) * radius; 
    fY = y + math.sin( math.rad( segAngle * i ) ) * radius; 
    tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; 
    tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; 
    dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); 
    end 
end 
  
addEventHandler("onClientRender", root,  
    function() 
        dxDrawCircle3D( 1603, -1696.4, 5, 3) 
    end 
) 

Thanks it's work's and thanks to #50p

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...