Difference between revisions of "DCS func isVisible"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
 
Line 52: Line 52:
 
}}
 
}}
 
[[Category:Singleton Functions|isVisible]]
 
[[Category:Singleton Functions|isVisible]]
 +
[[Category:Game Patch 1.2.0|isVisible]]

Latest revision as of 06:47, 17 March 2022

Scripting Root

Envrioment: Mission Scripting
Function: isVisible Added with: 1.2.0
Member Of: land
Syntax: boolean land.isVisible(table origin , table destination )
Description: Returns the boolean value if there is an terrain intersection via drawing a virtual line from the origin to the destination. Used for determining line of sight.


Return Value: boolean
Return Example: true or false
Examples: The following example outputs text based on the Line of Sight between a stationary target and a moving group that is moving over the ridge towards a target.
 local mover = Unit.getByName('mover'):getPosition().p
 mover.y = mover.y + 3
 local target = Unit.getByName('target'):getPosition().p
 target.y = target.y + 1.8
 trigger.action.outText('Is Visible: ' .. tostring(land.isVisible(mover, target)), 2)
Related Functions: land functions: getHeight, getSurfaceHeightWithSeabed, getSurfaceType, isVisible, getIP, profile, getClosestPointOnRoads, findPathOnRoads
Notes: Buildings and other objects are NOT tested and will NOT stop the ray being traced.

Also note that when dealing with ground objects for either object it is recommended to offset the y (height) value. The origin of most objects is at ground level so it is easily possible for the origin to start clipped inside of the terrain and thus always return a false value.