IsLineOfSightClear

This function checks if there are obstacles between two points of the game world, optionally ignoring certain kinds of elements. Use processLineOfSight if you want more information about what the ray hits.

checkDummies: Allow the line of sight to be blocked by GTA's internal dummies. These are not used in the current MTA version so this argument can be set to false.

seeThroughStuff: Allow the line of sight to be blocked by translucent game objects, e.g. glass.

ignoreSomeObjectsForCamera: Allow the line of sight to pass through objects that have (K) property enabled in "object.dat" data file. (i.e. Most dynamic objects like boxes or barrels)

ignoredElement: Allow the line of sight to pass through a certain specified element.

Returns

Returns true if the line between the specified points is clear, false if there's an obstacle or if invalid parameters are passed.

Example

Click to expand [+]

Client

isLineOfSightClear is the economical way to cast a ray in the world.
This example demonstrates how you can easily implement basic NPC behaviour such as jumping obstacles. A 3D line is drawn connecting the two points in the ray.