Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Draw.Circle on 2D plane


  • Please log in to reply
7 replies to this topic

#1
spade

spade

    Newbie

  • Members
  • 4 posts

Can't find API for drawing a circle on screen that's not on minimap or in 3D plane.

(external if it matters)

Surely it exists right?

if it doesn't might be able to make my own function with the source of Draw.CircleMinimap(...) if that's even public?

 


  • 0

#2
Zypppy

Zypppy

    Ex Global Support

  • Contributor
  • 1,817 posts

Are you talking about this ?

Spoiler
But thats only for minimap . Why u need 2D draw tho ?


  • 0

#3
spade

spade

    Newbie

  • Members
  • 4 posts

I wanted a 2D circle for cursorPos, 3D looks off


  • 0

#4
Zypppy

Zypppy

    Ex Global Support

  • Contributor
  • 1,817 posts

well the circle draw around mouse in  Gamsteron AIO works pretty smooth 


  • 0

#5
spade

spade

    Newbie

  • Members
  • 4 posts

it uses the same 3D method though ..

Spoiler


there's no way to draw circle in 2D plane then I assume?


  • 0

#6
Zypppy

Zypppy

    Ex Global Support

  • Contributor
  • 1,817 posts

Not that I know of 


  • 0

#7
ReverseMisaya

ReverseMisaya

    Advanced Member

  • Members
  • 127 posts
  • Location🔰 SPACE 🔰

there's no way to draw circle in 2D plane then I assume?

 

Yes, you can code your own function for it:

local pi, cos, sin = math.pi, math.cos, math.sin
local assert = assert
local Vector = Vector

function DrawCircle2D(obj, r, q) --gameObject, range, quality => 1-100
   assert(obj.pos2D, "Could not find 2D-coordinates for this object")
   local r, q = r or 50, q and 2 * pi / q or 2 * pi / 20
   local x, y = obj.pos2D.x, obj.pos2D.y
   local pts = {}

   for th=0, 2 * pi + q, q do
     local pt_x, pt_y = x + r * cos(th), y - r * sin(th)
     pts[#pts+1] = Vector({x = pt_x, y = pt_y})
   end
  
   for i=1, #pts do
     local pt1, pt2 = pts[i], pts[i+1] or pts[1]
     Draw.Line(pt1, pt2)
   end
end

function OnDraw()
   DrawCircle2D(myHero, 500, 100)
end

  • 2

#8
spade

spade

    Newbie

  • Members
  • 4 posts

 

Yes, you can code your own function for it:

local pi, cos, sin = math.pi, math.cos, math.sin
local assert = assert
local Vector = Vector

function DrawCircle2D(obj, r, q) --gameObject, range, quality => 1-100
   assert(obj.pos2D, "Could not find 2D-coordinates for this object")
   local r, q = r or 50, q and 2 * pi / q or 2 * pi / 20
   local x, y = obj.pos2D.x, obj.pos2D.y
   local pts = {}

   for th=0, 2 * pi + q, q do
     local pt_x, pt_y = x + r * cos(th), y - r * sin(th)
     pts[#pts+1] = Vector({x = pt_x, y = pt_y})
   end
  
   for i=1, #pts do
     local pt1, pt2 = pts[i], pts[i+1] or pts[1]
     Draw.Line(pt1, pt2)
   end
end

function OnDraw()
   DrawCircle2D(myHero, 500, 100)
end

Thank you for your help, it looks great;

Spoiler


  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users