## Engine
Class LineOfSightTrigger

source: C:\XIII\Engine\Classes\LineOfSightTrigger.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Triggers
             |
             +--Engine.LineOfSightTrigger

Direct Known Subclasses:None

class LineOfSightTrigger
extends Engine.Triggers

    //=============================================================================
    // LineOfSightTrigger
    // triggers its event when player looks at it from close enough
    // ONLY WORKS IN SINGLE PLAYER (or for the local client on a listen server)
    // You could implement a multiplayer version using a tick function and PlayerCanSeeMe(),
    // but that would have more performance cost
    //=============================================================================

Variables
`int` | `MaxViewAngle` how directly a player must be looking at SeenActor center (in degrees)
`float` | `MaxViewDist` maximum distance player can be from this trigger to trigger it
`float` | `OldTickTime` maximum distance player can be from this trigger to trigger it
`float` | `RequiredViewDir` how directly player must be looking at SeenActor - 1.0 = straight on, 0.75 = barely on screen
`name` | `SeenActorTag` tag of actor which triggers this trigger when seen
`bool` | `bEnabled` maximum distance player can be from this trigger to trigger it

Function Summary
`void` | `PostBeginPlay()`
`void` | `Trigger(Actor Other, Pawn EventInstigator)`

Source Code

    00001	//=============================================================================
    00002	// LineOfSightTrigger
    00003	// triggers its event when player looks at it from close enough
    00004	// ONLY WORKS IN SINGLE PLAYER (or for the local client on a listen server)
    00005	// You could implement a multiplayer version using a tick function and PlayerCanSeeMe(),
    00006	// but that would have more performance cost
    00007	//=============================================================================
    00008	class LineOfSightTrigger extends Triggers
    00009		native;
    00010
    00011	var() float MaxViewDist;	// maximum distance player can be from this trigger to trigger it
    00012	var   float OldTickTime;
    00013	var() bool  bEnabled;
    00014	var	  bool  bTriggered;
    00015	var() name	SeenActorTag;	// tag of actor which triggers this trigger when seen
    00016	var	  actor SeenActor;
    00017	var() int MaxViewAngle;		// how directly a player must be looking at SeenActor center (in degrees)
    00018	var float RequiredViewDir;	// how directly player must be looking at SeenActor - 1.0 = straight on, 0.75 = barely on screen
    00019
    00020	function PostBeginPlay()
    00021	{
    00022		Super.PostBeginPlay();
    00023
    00024		RequiredViewDir = cos(MaxViewAngle * PI/180);
    00025		if ( (SeenActorTag != '') && (SeenActorTag != 'None') )
    00026			ForEach AllActors(class'Actor',SeenActor,SeenActorTag)
    00027				break;
    00028	}
    00029
    00030	event PlayerSeesMe(PlayerController P)
    00031	{
    00032		TriggerEvent(Event,self,P.Pawn);
    00033		bTriggered = true;
    00034	}
    00035
    00036	function Trigger( actor Other, Pawn EventInstigator )
    00037	{
    00038		bEnabled = true;
    00039	}
    00040
    00041	defaultproperties
    00042	{
    00043	     MaxViewDist=3000.000000
    00044	     bEnabled=True
    00045	     MaxViewAngle=15
    00046	     bCollideActors=False
    00047	}

End Source Code