Making draw.RoundedBox button?

Hey, I am making an entity that has a HUD interface on it. And I want to make a button on it. I already figured out how to check if the player is pressing the USE key and if all their important eye trace info.

But I cant think of a way on how to check if the player is specifically looking at a certain draw.RoundedBox element.
What I am basically trying to do is to make something like what you could make with WireMod EGP.

This is my entity drawing code

hook.Add("KeyPress", "MissileControl_KeyPress", function(_, key)
	if (key == IN_USE) then
		local ply = LocalPlayer()
		ply.isClicking = true

hook.Add("KeyRelease", "MissileControl_KeyRelease", function(_, key)
	if (key == IN_USE) then
		local ply = LocalPlayer()
		ply.isClicking = false

function ENT:Draw()
	local pos = self:GetPos() + self:GetRight() * 12
	local posTxt = self:GetPos() + self:GetRight() * 12.01
	local ang = self:GetAngles()
	ang:RotateAroundAxis(ang:Forward(), 90)
	cam.Start3D2D(pos, ang, 1)
		//How many missiles are left? Display
		local red = 0
		local plys = player.GetAll()
		for k,ply in pairs(plys) do
			local _distance = ply:GetPos():Distance(self:GetPos())
			local _hitentity = ply:GetEyeTrace().Entity
			local _hitpos = ply:GetEyeTrace().HitPos
			local _isclicking = ply.isClicking
			if(IsValid(ply) && _distance < 150) then
				if(_hitentity == self && _isclicking) then
					red = 255
		draw.RoundedBox(0,-78,-10,156,21,Color(red,0,0)) //This is the Box I am trying to turn into a button.
                //There is more code down here. But is not relevant to the button question.

That should point you in the right direction :slight_smile:

I tried that, but it was too difficult to constantly move the VGUI frame according to the ent’s location. Only option left is draw. elements.

I heard something about util.rayintersectwithplane but I have no idea how to use it.