Drawing 3D2D element through walls?

I am making a system wherein a player can call out a distress. In case of a distress, that player will be market as having a distress.
I want to show where that player is using the HUD of all other players.

Example:

My aim is to make this visible through walls so that you can see it no matter distance and obstacles.

I have no idea how I would even try to do this. Thats why I am here.

Any helps is very much appreciated :smiley:



			cam.IgnoreZ(true)


Turn on after you start 3d2d camera, turn off before you end the 3d2d.

Why would you use 3D2D for a dot?

Vector:ToScreen

If I remember correctly, vector.ToScreen doesn’t work properly in a 2D hook, so you’d need to store the value using a 3D hook and do your screen drawing in a 2D hook.

If you do want to use 3D2D, you’re looking for

cam.IgnoreZ, which should be set to true, then do your 3D2D drawing, then set it to false again.

Vector:ToScreen works unless you’ve had a more-recent rendering context created with non-default parameters. You can get around that like so.



hook.Add( "HUDPaint", "", function()
    cam.Start3D(); cam.End3D()

    -- Use Vector:ToScreen here
end )


The related GitHub issue can be found @ https://github.com/Facepunch/garrysmod-issues/issues/1404/.

Thanks a bunch everyone! This was really helpful! :smiley:

How would I get the X and Y split from the Vector:ToScreen to be used in a HUDPaint thingy?

[lua]
local pos = Vector:ToScreen()
local x = pos.x
local y = pos.y
[/lua]

The wiki link I gave you said exactly that.

Sorry. Stupid me strikes again. Thanks meharryp (and bitches of course!)

It all worked out :smiley: