# how to make circle around our self ?

Hi all everything is in the title.

I want to make a simple circle around my self is it possible to do this in HUDPaint ?
any hint ?

Thanks

You would use cam.Start3D2D and the PostPlayerDraw hook.

Here’s some example code:
[lua]
local v = {}
hook.Add(“CalcView”, “render_circle_under_ply.CalcView”, function(ply, pos, angles, fov)
v.origin = pos+(angles:Forward()*-125)
v.angles = angles
return v
end)

return false
end)

return true
end)

local boxW, boxH = 50, 50
if ply != LocalPlayer() then return end
cam.Start3D2D(ply:GetPos(), Angle(0,0,0), 1)
cam.IgnoreZ(true)
draw.RoundedBox(0, -(boxW/2), -(boxH/2), boxW, boxH, Color(255,255,255,50))
cam.IgnoreZ(false)
cam.End3D2D()
end)
[/lua]

What type of circle?

There is a DrawCircle function which just draws a lot of dots. You can create your own which should link dots together with lines, or even draw a poly…

Half of a circle is PI, while a full circle is 2 * PI.

You’ll need to calculate the angle, x, y in a loop for each point you want to calculate.

angle would be the slices which is ( 2 * math.pi ) / points_in_the_circle

x is the origin.x + circle_radius * math.cos( angle )
y is the origin.y + circle_radius * math.sin( angle )

I already seen this I think with ULX but i’m not really sure.

here an idea wich one I try to find.

http://s2.postimg.org/rrzc4p5p1/PS3_Multiplayer_16592_007.jpg

thanks brandonj4 , but the others players can see this ? or its just me ?
and also it is possible to have it directly to the ground ?

Your best bet is to have a texture and to use the hit normal of a trace coming down from the players pos, to update the angles of the circle. If you want it to be upright all the time, then just use my code.

If you want it to sculpt to the ground your standing on, I’m not sure what you could do other than use a env_projected texture which is unlikely.

Also you would use the PrePlayerDraw hook for drawing behind the player.

Oh I found something that I saw before,

there is an image :
http://s27.postimg.org/3t7uyyqf7/rpevocityv2d0004.jpg

But when I trying to test the 1st code it say

``````
[ERROR] lua/autorun/client/admintestdin.lua:806: attempt to index global 'GM' (a nil value)
1. unknown - lua/autorun/client/admintestdin.lua

``````

Edit :
Oh i found below in the post

``````
local CircleMat = Material( "SGM/playercircle" )

hook.Add( "PrePlayerDraw", "PlayerRings", function( ply )

------------------------------------
local colour = Color(255,0,255,75)-- Only change these
local radius = 70                 --
------------------------------------

local trace = {}
trace.start = ply:GetPos() + Vector(0,0,50)
trace.endpos = trace.start + Vector(0,0,-300)
trace.filter = ply
local tr = util.TraceLine( trace )
if !tr.HitWorld then
tr.HitPos = ply:GetPos()
end
render.SetMaterial( CircleMat )