Jump to content

[Help] Marker Model


3B00DG4MER

Recommended Posts

Posted

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.

Posted
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 ?

Posted

It doesn't. It just shows the circle on the ground. If you want to create marker, draw circle, put colshape on it and check if someone got into circle by using onColShapeHit.

Posted
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

Posted

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.

Posted
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 ?

Posted

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 
) 

Posted
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

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