IsLineOfSightClear: Difference between revisions
Jump to navigation
Jump to search
(Fixxed Bot Section) |
Einheit-101 (talk | contribs) (seeThroughStuff argument is actually inverted, setting it to TRUE allows the line of sight to pass through "seeThrough" surface materials. I added this information and highlighted it respectively.) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
{{Client function}} | {{Client function}} | ||
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. | 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. | ||
{{Note|This function does currently NOT support collisions with the "shootthrough" flag enabled. That means: isLineOfSightClear will never collide with such collisions and this can lead to unreliabilities. The "shootthrough" flag is used by many beach/sand/underwater objects.}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
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 ] ) | 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 ] ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 23: | Line 26: | ||
*'''checkObjects:''' Allow the line of sight to be blocked by [[Object|objects]]. | *'''checkObjects:''' Allow the line of sight to be blocked by [[Object|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''. | *'''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 | *'''seeThroughStuff:''' Allow the line of sight to '''pass through''' collision materials that have this flag enabled (By default material IDs 52, 55 and 66 which are some fences). This flag originally allows some objects to be walked on but you can shoot throug them. | ||
*'''ignoreSomeObjectsForCamera:''' Allow the line of sight to | *'''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. | *'''ignoredElement:''' Allow the line of sight to pass through a certain specified element. | ||
Latest revision as of 14:00, 27 June 2020
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 pass through collision materials that have this flag enabled (By default material IDs 52, 55 and 66 which are some fences). This flag originally allows some objects to be walked on but you can shoot throug them.
- 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
- createSWATRope
- getBirdsEnabled
- getCoronaReflectionsEnabled
- getGarageBoundingBox
- getGaragePosition
- getGarageSize
- getGroundPosition
- getInteriorFurnitureEnabled
- getNearClipDistance
- getPedsLODDistance
- getRoofPosition
- getScreenFromWorldPosition
- getVehiclesLODDistance
- getWorldFromScreenPosition
- isAmbientSoundEnabled
- isLineOfSightClear
- isWorldSoundEnabled
- processLineOfSight
- resetAmbientSounds
- resetBlurLevel
- resetColorFilter
- resetCoronaReflectionsEnabled
- resetNearClipDistance
- resetPedsLODDistance
- resetVehiclesLODDistance
- resetWorldSounds
- setAmbientSoundEnabled
- setBirdsEnabled
- setColorFilter
- setCoronaReflectionsEnabled
- setInteriorFurnitureEnabled
- setInteriorSoundsEnabled
- setNearClipDistance
- setPedsLODDistance
- setVehiclesLODDistance
- setWorldSoundEnabled
- testLineAgainstWater
- areTrafficLightsLocked
- getAircraftMaxHeight
- getAircraftMaxVelocity
- getCloudsEnabled
- getFarClipDistance
- getFogDistance
- getGameSpeed
- getGravity
- getHeatHaze
- getInteriorSoundsEnabled
- getJetpackMaxHeight
- getMinuteDuration
- getMoonSize
- getOcclusionsEnabled
- getRainLevel
- getSunColor
- getSunSize
- getTime
- getTrafficLightState
- getWeather
- getWindVelocity
- getSkyGradient
- getPlayerBlurLevel
- getZoneName
- isGarageOpen
- removeWorldModel
- resetFarClipDistance
- resetFogDistance
- resetHeatHaze
- resetMoonSize
- resetRainLevel
- resetSkyGradient
- resetSunColor
- resetSunSize
- resetWindVelocity
- restoreAllWorldModels
- restoreWorldModel
- setAircraftMaxHeight
- setAircraftMaxVelocity
- setCloudsEnabled
- setFarClipDistance
- setFogDistance
- setGameSpeed
- setGarageOpen
- setGravity
- setHeatHaze
- setInteriorSoundsEnabled
- setMinuteDuration
- setMoonSize
- setOcclusionsEnabled
- setRainLevel
- setSkyGradient
- setSunColor
- setSunSize
- setTime
- setTrafficLightState
- setTrafficLightsLocked
- setWeather
- setWeatherBlended
- setWindVelocity
- setJetpackMaxHeight
- setPlayerBlurLevel