Adding vector positions onto ent:GetPos()

I need a bit of help here guys/girls. I’ve been having a problem successfully getting a vector to add onto a known position of an ent. So basically:

–This is an example, not the real thing
Not sure if lua tags were necessary, but I hope you get the point. This is within an ent.


What’s wrong with that?

Oh, I think your problem is you were using “self.Entity”. That only works when you’re making an entity (unless this was); use “cokecan” as the entity, not “self.Entity”.

self.Entity is the thing that the cokecan is being spawned on, or from.


so self.Entity is … table.

If self.Entity and cokecan exists, then it should work fine.

1x Agree. Your current code should be AOK if you make sure to define cokecan and self.Entity correctly.

Yea, I got it, thanks for the post’s guys. I’m making a lot of little mistakes today. It’s horrible. But rather than making a new thread, is there a way to draw a little box beneath the pop can? Like a green box? 3d2d or w/e you would use.

I’d use render.DrawQuadEasy for that.

I’m messing with that a bit, but it still doesn’t seem to draw; does that have to be in Start3D2D still?


[lua]function ENT:Draw()
for i = 1, 64 do
local pos = grid*.POS+Vector(-3.5,-3.5,10)
local ang = Angle(0,0,0)

Here is what 3d2d does it draws a 2d element in 3d space so if you get futher away it shrinks and if you get closer it grows on your screen and it angles depending ont he direction you look at it. Simply just drawing a render.DrawQuadEasy would draw it directly on your screen at hte location so it woudl allways be the same size.

So then I do need the cam. However, I put print(‘yay?’) in the ENT:Draw() and it does not print that. Is there just some reason for that, or does it just not access the draw function.

Draw() is only called when you are looking in the general direction of the entity, to preserve resources.

Well, I was looking directly at it >.<