• how to make circle around our self ?
    5 replies, posted
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
[QUOTE=lotus006;43755125]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[/QUOTE] You would use [URL="http://wiki.garrysmod.com/page/cam/Start3D2D"]cam.Start3D2D[/URL] and the [URL="http://wiki.garrysmod.com/page/GM/PostPlayerDraw"]PostPlayerDraw[/URL] 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) hook.Add("PreDrawViewModel", "render_circle_under_ply.PreDrawViewModel", function() return false end) hook.Add("ShouldDrawLocalPlayer", "render_circle_under_ply.ShouldDrawLocalPlayer", function(ply) return true end) local boxW, boxH = 50, 50 hook.Add("PostPlayerDraw", "render_circle_under_ply.PreDrawViewModel", function(ply) 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. [url=http://postimg.org/image/rrzc4p5p1/][img]http://s2.postimg.org/rrzc4p5p1/PS3_Multiplayer_16592_007.jpg[/img][/url] 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 [URL="http://wiki.garrysmod.com/page/GM/PrePlayerDraw"]PrePlayerDraw[/URL] hook for drawing behind the player.
Oh I found something that I saw before, This thread : [URL="http://facepunch.com/showthread.php?t=1034298"]http://facepunch.com/showthread.php?t=1034298[/URL] there is an image : [url=http://postimage.org/][img]http://s27.postimg.org/3t7uyyqf7/rpevocityv2d0004.jpg[/img][/url] But when I trying to test the 1st code it say [CODE][ERROR] lua/autorun/client/admintestdin.lua:806: attempt to index global 'GM' (a nil value) 1. unknown - lua/autorun/client/admintestdin.lua [/CODE] Edit : Oh i found below in the post [CODE]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 ) render.DrawQuadEasy( tr.HitPos + tr.HitNormal, tr.HitNormal, radius, radius, colour ) end )[/CODE]
Sorry, you need to Log In to post a reply to this thread.