IsLineOfSightClear
From Multi Theft Auto: Wiki
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.
Syntax
bool isLineOfSightClear ( float startX, float startY, float startZ, float endX, float endY, float endZ, [ bool checkBuildings = true, bool checkVehicles = true, bool checkPeds = true, bool checkObjects = true, bool checkDummies = true, bool seeThroughStuff = false, bool ignoreSomeObjectsForCamera = false, element ignoredElement = nil ] )
Required Arguments
- startX: The first point's world X coordinate.
- startY: The first point's world Y coordinate.
- startZ: The first point's world Z coordinate.
- endX: The second point's world X coordinate.
- endY: The second point's world Y coordinate.
- endZ: The second point's world Z coordinate.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- checkBuildings: Allow the line of sight to be blocked by GTA's internally placed buildings, i.e. the world map.
- checkVehicles: Allow the line of sight to be blocked by vehicles.
- checkPeds: Allow the line of sight to be blocked by peds, i.e. players.
- checkObjects: Allow the line of sight to be blocked by objects.
- 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 [+]
ClientSee Also
- areTrafficLightsLocked
- createSWATRope
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getBirdsEnabled
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGravity
- getGroundPosition
- getHeatHaze
- getInteriorFurnitureEnabled
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getNearClipDistance
- getOcclusionsEnabled
- getPedsLODDistance
- setPedsLODDistance
- resetPedsLODDistance
- getPlayerBlurLevel
- getRainLevel
- getScreenFromWorldPosition
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getVehiclesLODDistance
- getWeather
- getWindVelocity
- getWorldFromScreenPosition
- getZoneName
- isAmbientSoundEnabled
- isGarageOpen
- isLineOfSightClear
- isWorldSoundEnabled
- isWorldSpecialPropertyEnabled
- processLineOfSight
- removeWorldModel
- resetAmbientSounds
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetVehiclesLODDistance
- resetWindVelocity
- resetWorldSounds
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setAmbientSoundEnabled
- setBirdsEnabled
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setJetpackMaxHeight
- setMinuteDuration
- setMoonSize
- setNearClipDistance
- setOcclusionsEnabled
- setPlayerBlurLevel
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setVehiclesLODDistance
- setWeather
- setWeatherBlended
- setWindVelocity
- setWorldSoundEnabled
- setWorldSpecialPropertyEnabled
- testLineAgainstWater