Line of sight: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(BlockLOS also works for some bots. Used BlockLOS image.)
m (Unicodifying)
 
Line 2: Line 2:
'''Line of sight''' (sometimes written '''line-of-sight''' or abbreviated to '''LoS''' or '''LOS''') is an invisible straight line used to determine whether entities can see other entities in the world. If the line of sight is unobstructed from a viewer to a target, it is "established", and the game determines that the viewer can see the target.
'''Line of sight''' (sometimes written '''line-of-sight''' or abbreviated to '''LoS''' or '''LOS''') is an invisible straight line used to determine whether entities can see other entities in the world. If the line of sight is unobstructed from a viewer to a target, it is "established", and the game determines that the viewer can see the target.


LOS is blocked by all Solid geometry (Models, [[func_detail]] brushes, etc.) unless the brush/model has a SolidMask that is NotSolid to LOS, i.e. Transparent.
LOS is blocked by all Solid geometry (Models, [[func detail]] brushes, etc.) unless the brush/model has a SolidMask that is NotSolid to LOS, i.e. Transparent.


Some [[prop_physics]] do not block LOS. Use {{ent|ai_debug_los}} to check which props.
Some [[prop physics]] do not block LOS. Use {{ent|ai_debug_los}} to check which props.


[[NPC]]s can only establish line of sight within their [[viewcone]], in turn established by the width of their [[Field of View]], in turn established by the value of their [[m_flFieldOfView]].
[[NPC]]s can only establish line of sight within their [[viewcone]], in turn established by the width of their [[Field of View]], in turn established by the value of their [[m flFieldOfView]].


NPCs can fire [[Inputs and Outputs#Outputs|Outputs]] if it finds or loses line of sight to an enemy (<code>OnFoundEnemy/OnLostEnemyLOS</code>) or specifically the player (<code>OnFoundPlayer/OnLostPlayerLOS</code>).
NPCs can fire [[Inputs and Outputs#Outputs|Outputs]] if it finds or loses line of sight to an enemy (<code>OnFoundEnemy/OnLostEnemyLOS</code>) or specifically the player (<code>OnFoundPlayer/OnLostPlayerLOS</code>).
Line 16: Line 16:
==See also==
==See also==


*[[NPC_FOV]] - A list of NPC [[m_flFieldOfView]] values.
*[[NPC FOV]] - A list of NPC [[m flFieldOfView]] values.
*[[Talk:NPC_Sensing]]
*[[Talk:NPC Sensing]]


[[Category:Glossary]]
[[Category:Glossary]]

Latest revision as of 15:04, 7 January 2024

English (en)Polski (pl)Русский (ru)中文 (zh)Translate (Translate)

Line of sight (sometimes written line-of-sight or abbreviated to LoS or LOS) is an invisible straight line used to determine whether entities can see other entities in the world. If the line of sight is unobstructed from a viewer to a target, it is "established", and the game determines that the viewer can see the target.

LOS is blocked by all Solid geometry (Models, func detail brushes, etc.) unless the brush/model has a SolidMask that is NotSolid to LOS, i.e. Transparent.

Some prop physics do not block LOS. Use ai_debug_los to check which props.

NPCs can only establish line of sight within their viewcone, in turn established by the width of their Field of View, in turn established by the value of their m flFieldOfView.

NPCs can fire Outputs if it finds or loses line of sight to an enemy (OnFoundEnemy/OnLostEnemyLOS) or specifically the player (OnFoundPlayer/OnLostPlayerLOS).

Toolsblocklos.gif

The Block LOS tool texture is specifically designed to block NPC LOS. Some bots are also affected by this texture.

See also