Jump to content

PointInZone

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: pointInZone
Function Description: Determines whether a given 2‑D point (x, z) lies within the area of a named zone. The function accepts both circular zones (defined by a radius) and polygonal zones (defined by vertices). It first retrieves the zone data via CMM.getZone and then performs either a radial distance check or a point‑in‑polygon test.
File Location: cmm.DCSFunctions.lua
Syntax: CMM.pointInZone( table point , string ZoneName )
Return Value: boolean
Parameters: Name Description
pointTable containing at least x and z coordinates (e.g., {x = 12345, z = -67890}).
ZoneNameName of a zone defined in the mission editor.
Example: local inside = CMM.pointInZone({x=12000, z=-65000}, "WeaponsRange02")
Example Description: The example demonstrates a simple call to check whether a specific location falls inside the zone "WeaponsRange02". The function will automatically handle circular or polygonal zones and return a boolean result.
Related Functions:
Notes: