Revision Difference
Entity:SetEyeTarget#527745
<function name="SetEyeTarget" parent="Entity" type="classfunc">
<description>Sets the position an entity's eyes look toward.</description>
<realm>Shared</realm>
<args>
<arg name="pos" type="Vector">The world position the entity is looking toward.</arg>
</args>
</function>
<example>
<description>Makes an NPC (self) look into a nearby player's eyes.</description>
<code>
for p, ply in pairs(player.GetAll()) do
for p, ply in ipairs(player.GetAll()) do
if(ply:EyePos():Distance(self:EyePos()) <= 60) then
self:SetEyeTarget(ply:EyePos())
break
end
end
</code>
</example>
<example>
<description>Makes an entity look at a vector the way the eyeposer does it</description>
<code>
local lookat = Vector( 0, 0, 0 )
local attachment = ent:GetAttachment( ent:LookupAttachment( "eyes" ) )
local LocalPos, LocalAng = WorldToLocal( lookat, Angle( 0, 0, 0 ), attachment.Pos, attachment.Ang )
ent:SetEyeTarget( LocalPos )
</code>
</example>