I’m horrible with angles, I was wondering if someone could help me out.
[lua]function ENT:SpawnFunction(ply, tr)
//spawn code blah timer.Simple(.1, function() local pos = ent:GetPos(); local ppos = ply:GetPos(); local up = ent:GetUp(); local tr = util.QuickTrace((pos + (up * 16)), (up * -64), ent); local ang = tr.HitNormal:Angle(); ang:RotateAroundAxis(ang:Right(), -90); ent:SetPos(tr.HitPos); ent:SetAngles(ang); end); return ent;
This works fine for setting my entity parallel with a surface, on slopes and such, but I also want him oriented to face the player that spawned him. This is where I need some help. I’m not sure how to incorporate this and not fuck up the parallel stuff.
[lua]local faceang = (plypos - entpos):Angle()[/lua]