Need help with Cam3d2d

So I made a tool that creates an entity at your Crosshair, but I can’t create a Cam3D2D on the entity.

Any help would be appreciated.



    function TOOL:LeftClick( trace )
	ply = self:GetOwner()

		ent = ents.Create("base_gmodentity")
		ent:SetModel("models/hunter/blocks/cube025x025x025.mdl")
		ent:SetPos(Vector(trace.HitPos))
		ent:Spawn()

		undo.Create("Waypoint")
		undo.SetCustomUndoText("Removed Waypoint")
		undo.AddEntity(ent)
		undo.SetPlayer(ply)
		undo.Finish()

	function ent:Draw()
		cam.Start3D2D(ent:GetPos(),ent:GetAngles(),2)
			draw.SimpleText("test","TheDefaultSettings",50,50,Color(0,255,0),1,1)
		cam.End3D2D()
	end

end

:snip: misread

[editline]15th January 2017[/editline]

You could try creating a custom entity and spawning that

I’ve tried creating a custom Entity folder which all works well, but when I Include the file in my tool script, none of the references to the Entity work. Mabye I’m including it wrong? The entity is in it’s own folder when I try it that way.

Try putting it in lua/entities - there’s some example entities in there to give you an idea - it could probably fit in one file without the need for another custom folder

[editline]15th January 2017[/editline]

I don’t know if you need to include it but I think you need to AddCSLuaFile() it in a lua/autorun file

Will try thanks