Garry's Mod Wiki

Entity:SetEyeTarget

Entity:SetEyeTarget( Vector pos )

Description

Sets the position an entity's eyes look toward.

Arguments

1 Vector pos
The world position the entity is looking toward.

Example

Makes an NPC (self) look into a nearby player's eyes.

for p, ply in ipairs(player.GetAll()) do if(ply:EyePos():Distance(self:EyePos()) <= 60) then self:SetEyeTarget(ply:EyePos()) break end end

Example

Makes an entity look at a vector the way the eyeposer does it

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 )

Page Links


Special Pages


Wikis

?

Render Time: 77ms

DB GetPage 42
Generate Html 3
SaveChanges (1) 17
Render Body 0
Render Sidebar 12