Class TriggerLook
Namespace: ValveResourceFormat.Renderer.Entities
Assembly: Renderer.dll
trigger_look. Fires OnTrigger once the player inside it has looked at its target for TriggerLook.LookTime seconds, and OnTimeout if they spend timeout seconds inside without managing it.
public sealed class TriggerLook : BaseTriggerInheritance
object ← BaseEntity ← BaseModelEntity ← BaseTrigger ← TriggerLook
Inherited Members
BaseTrigger.IsEnabled, BaseModelEntity.Solid, BaseModelEntity.ModelNode, BaseEntity.Scene, BaseEntity.RootNode, BaseEntity.Transform, BaseEntity.RigidTransform, BaseEntity.LayerName, BaseEntity.EntitySystem, BaseEntity.Data, BaseEntity.SpawnData, BaseEntity.NameFixup, BaseEntity.Classname, BaseEntity.TargetName, BaseEntity.SpawnFlags, BaseEntity.SpawnTransform, BaseEntity.Owner, BaseEntity.MoveParent, BaseEntity.EntityScale, BaseEntity.ModelName, BaseEntity.Origin, BaseEntity.Angles, BaseEntity.WorldOrigin, BaseEntity.WorldAngles, BaseEntity.Velocity, BaseEntity.AngularVelocity, BaseEntity.NextThink, BaseEntity.MoveDoneTime, BaseEntity.IsRemoved, BaseEntity.Collider, BaseEntity.IsSolid, BaseEntity.IsTrigger, BaseEntity.IsDrawn, BaseEntity.IsCollidable, BaseEntity.TouchingEntities, BaseEntity.HasSpawnFlags<TSpawnFlags>(TSpawnFlags), BaseEntity.Spawn(), BaseEntity.Activate(), BaseEntity.Think(), BaseEntity.RoundStart(), BaseEntity.MoveDone(), BaseEntity.TryGetTouchBounds(out Vector3, out Vector3), BaseEntity.ObjectCaps, BaseEntity.Use(BaseEntity?), BaseEntity.Teleport(Vector3, Vector3?), BaseEntity.AcceptInput(string, EntityInputData), BaseEntity.SetNextThink(float), BaseEntity.SetMoveDoneTime(float), BaseEntity.GetSurfaceVelocity(Vector3), BaseEntity.AngleMod(float)
Remarks
In the engine this is a trigger_once, but it replaces the touch outright, so nothing of TriggerMultiple is left to inherit. The look is tested on every touch: the view direction (or the direction of travel) has to be within TriggerLook.FieldOfView of the direction from the eye to the target's origin, a cosine rather than an angle. Looking away or leaving resets the clock.
test_occlusion traces to the target against the world, test_visible_occlusion against solid entities too; hitting the target itself still counts as seeing it.
Constructors
TriggerLook(EntitySystem, EntitySpawnInfo)
Initializes a trigger_look from its keyvalues.
public TriggerLook(EntitySystem system, EntitySpawnInfo spawnInfo)Parameters
system EntitySystem
spawnInfo EntitySpawnInfo
Properties
FieldOfView
Gets the cosine of the widest angle between the view and the target that still counts as looking at it: 1 is dead ahead, 0 is anywhere in front, -1 is any direction.
public float FieldOfView { get; }Property Value
float
LookTime
Gets how many seconds the target has to be looked at before the trigger fires.
public float LookTime { get; }Property Value
float
Methods
OnEndTouch(BaseEntity)
Runs on the tick other leaves this entity's volume.
protected override void OnEndTouch(BaseEntity other)Parameters
other BaseEntity
OnStartTouch(BaseEntity)
Runs on the tick other enters this entity's volume.
protected override void OnStartTouch(BaseEntity other)Parameters
other BaseEntity
OnTouch(BaseEntity)
Runs every tick other is inside this entity's volume, the tick it entered included, and on a tick the player ran into this solid entity while moving.
protected override void OnTouch(BaseEntity other)Parameters
other BaseEntity
Spawn()
Sets up the entity (model, class keyvalues, first think). Called by EntityFactory right after construction, before the entity enters the world.
public override void Spawn()Think()
Times out, unless the player managed to look in time.
public override void Think()
