Jump to content

FindNearestPilot

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: FindNearestPilot
Function Description: Finds the nearest pilot to a given 3D position by retrieving player information, calculating distances, and returning the closest pilot's data, which will always represent the pilot of a multi-crew airframe.
File Location: cmm.netFunctions.lua
Syntax: CMM.FindNearestPilot( table vec3 )
Return Value: table
Parameters: Name Description
vec3A table containing the 3D position {x, y, z} to find the nearest pilot to.
Example: CMM.FindNearestPilot({x=100, y=200, z=300})
Example Description: Finds the closest pilot to the position (100, 200, 300) and returns their player information with distance and object reference.
Related Functions:
Notes: