This article's documentation is for anything that uses the Source engine. Click here for more information.

Point anglesensor: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Used KV/I/O BaseEntity templates. Template:in code -> Template:code class.)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{base point|point_anglesensor}}
{{CD|CPointAngleSensor|file1=pointanglesensor.cpp}}
{{this is a|point entity|name=point_anglesensor}}
It detects whether another entity points in a given direction for a period of time.  
It detects whether another entity points in a given direction for a period of time.  
{{code class|CPointAngleSensor|pointanglesensor.cpp}}


== KeyValues ==
== KeyValues ==
{{KV|Target Entity Name|target_destination|Name of the entity whose angles will be sensed.}}
{{KV Targetname}}
{{KV|Look At Entity|target_destination|The entity we want to check to see if the Target Entity is looking at.}}
{{KV|Target Entity Name|intn=target|target_destination|Name of the entity whose angles will be sensed.}}
{{KV|Duration|float|The amount of time the Target Entity must look at the 'Look at Entity' to trigger this entity, in seconds.}}
{{KV|Look At Entity|intn=lookatname|target_destination|The entity we want to check to see if the Target Entity is looking at.}}
{{KV|Tolerance|integer|The tolerance, in degrees, in the checking to determine when the Target Entity is looking at the Look At Entity.}}
{{KV|Duration|intn=duration|float|The amount of time the Target Entity must look at the 'Look at Entity' to trigger this entity, in seconds.}}
{{KV|Tolerance|intn=tolerance|integer|The tolerance, in degrees, in the checking to determine when the Target Entity is looking at the Look At Entity.}}
{{KV EnableDisable}}
{{KV EnableDisable}}
{{KV BaseEntity}}


== Flags ==
== Flags ==
Line 16: Line 15:


== Inputs ==
== Inputs ==
{{IO|Toggle|Toggle the sensor between enabled and disabled.}}
{{I|Toggle|Toggle the sensor between enabled and disabled.}}
{{IO|Test|Check to see if the Target Entity is facing the Look At Entity within the specified tolerance, firing either the <code>OnFacingLookat</code> or <code>OnNotFacingLookat</code> output based on the result.}}
{{I|Test|Check to see if the Target Entity is facing the Look At Entity within the specified tolerance, firing either the <code>OnFacingLookat</code> or <code>OnNotFacingLookat</code> output based on the result.}}
{{I EnableDisable}}
{{I EnableDisable}}
{{I BaseEntity}}


== Outputs ==
== Outputs ==
{{IO|TargetDir|Fired when the forward direction of the Target Entity changes. Passes the new forward direction as a parameter.|param=vector}}
{{O|TargetDir|Fired when the forward direction of the Target Entity changes. Passes the new forward direction as a parameter.
{{IO|OnFacingLookat|Fired when the Target Entity points at the Look At Entity for more than the specified Duration, or in response to a <code>Test</code> input.}}
:{{seealso|[[Special:WhatLinksHere/RedirectInput/Vector|See entities that have an input of Vector type]]}}|param=vector}}
{{IO|OnNotFacingLookat|Fires in response to a <code>Test</code> input when the Target Entity is not pointing at the Look At Entity.}}
{{O|OnFacingLookat|Fired when the Target Entity points at the Look At Entity for more than the specified Duration, or in response to a <code>Test</code> input.}}
{{IO|FacingPercentage|Normalized value (0..1) where 1 is facing directly at target and 0 is at or beyond the angle of tolerance.|param=float}}
{{O|OnNotFacingLookat|Fires in response to a <code>Test</code> input when the Target Entity is not pointing at the Look At Entity.}}
{{O BaseEntity|l4d=1}}
{{O|FacingPercentage|Normalized value (0..1) where 1 is facing directly at target and 0 is at or beyond the angle of tolerance.|param=float}}


== See Also ==
== See also ==
[https://www.youtube.com/watch?v=vNhKk1gosCI?t=139: Youtube video about the Point_AngleSensor]
* [https://www.youtube.com/watch?v=vNhKk1gosCI?t=139: Youtube video about the Point_AngleSensor]

Latest revision as of 14:12, 7 May 2025

C++ Class hierarchy
CPointAngleSensor
CPointEntity
CBaseEntity
C++ pointanglesensor.cpp

point_anglesensor is a point entity available in all Source Source games. It detects whether another entity points in a given direction for a period of time.

KeyValues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Target Entity Name (target) <targetname>
Name of the entity whose angles will be sensed.
Look At Entity (lookatname) <targetname>
The entity we want to check to see if the Target Entity is looking at.
Duration (duration) <float>
The amount of time the Target Entity must look at the 'Look at Entity' to trigger this entity, in seconds.
Tolerance (tolerance) <integer>
The tolerance, in degrees, in the checking to determine when the Target Entity is looking at the Look At Entity.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Flags

Use target entity's angles (NOT position) : [1]

Inputs

Toggle
Toggle the sensor between enabled and disabled.
Test
Check to see if the Target Entity is facing the Look At Entity within the specified tolerance, firing either the OnFacingLookat or OnNotFacingLookat output based on the result.

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Outputs

TargetDir <vectorRedirectOutput/Vector>
Fired when the forward direction of the Target Entity changes. Passes the new forward direction as a parameter.

OnFacingLookat
Fired when the Target Entity points at the Look At Entity for more than the specified Duration, or in response to a Test input.
OnNotFacingLookat
Fires in response to a Test input when the Target Entity is not pointing at the Look At Entity.
FacingPercentage <floatRedirectOutput/float>
Normalized value (0..1) where 1 is facing directly at target and 0 is at or beyond the angle of tolerance.

See also