DCS func isVisible
From DCS World Wiki - Hoggitworld.com
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. |