c_scan (VECTOR* pos, ANGLE* ang, VECTOR* sector, var mode)

Detects entities or other objects within a cone or sphere, and triggers their EVENT_SCAN event.

Parameters:

pos scan origin.
ang scan direction Euler angle.
sector.x horizontal scan sector, or scan cone width in degrees (360 for a full sphere)
sector.y vertical scan sector in degrees, or 0 for a circular scan cone.
sector.z scan range in quants.
mode scan mode (see below).

The following mode values can be set:

IGNORE_ME Ignores the me entity; to be combined with SCAN_ENTS.
IGNORE_YOU Ignores the you entity and does not set the you pointer; to be combined with SCAN_ENTS.
IGNORE_PASSABLE  LC  Ignores entities with the PASSABLE flag; to be combined with SCAN_ENTS.
IGNORE_FLAG2  LC  Ignores entities with FLAG2; to be combined with SCAN_ENTS. For ignoring certain entity groups, call c_ignore before c_scan.
IGNORE_WORLD Ignores all terrains; to be combined with SCAN_ENTS.
IGNORE_MAPS Ignores all map entities; to be combined with SCAN_ENTS.
IGNORE_MODELS Ignores all models; to be combined with SCAN_ENTS.
IGNORE_SPRITES Ignores all sprites; to be combined with SCAN_ENTS.
SCAN_ENTS Scans for entities within the cone, and triggers their EVENT_SCAN event.
SCAN_POS Scans for camera positions placed in the level.
SCAN_PATHS Scans for path start positions.
SCAN_NODES Scans for path node positions.
SCAN_LIGHTS Scans for static lights.
SCAN_LIMIT Finds only entities with ENABLE_SCAN set, or only static lights whose range can reach the scan origin. Can be combined with SCAN_ENTS and SCAN_LIGHTS.
SCAN_FLAG2  LC  Opposite of IGNORE_FLAG2: finds only entities with FLAG2. To be combined with SCAN_ENTS.

Returns:

Distance to closest object found, or 0 if no object was found.

Modifies:

you Pointer to the closest detected entity.
result Distance to the closest detected object.
target Position of the closest detected object.
bounce Direction to the closest detected camera position.
tex_color Color of the closest detected static light.

Remarks:

Speed:

Slow

Example:

function operate() // scan nearby doors or switches for operating them
{
 	c_scan(camera.x,camera.pan,vector(120,0,200),SCAN_ENTS | SCAN_LIMIT);
}
...
on_space = operate;

See also:

c_trace, path_scan, EVENT_DETECT, EVENT_SCAN

► latest version online