Garry's Mod Wiki

Garry's Mod Wiki

  Entity:SetEyeTarget( Vector pos )

Description

Sets the position an entity's eyes look toward. This works as an override for default behavior. Set to 0,0,0 to disable the override.

Arguments

1 Vector pos
If NPC, the world position for the entity to look towards, for Ragdolls, a local position in front of their eyes attachment.

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 )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...