Difference between revisions of "DCS func getPoint"

From DCS World Wiki - Hoggitworld.com
Line 46: Line 46:
 
     env.info('The World Coordinates of the target are: X: ' .. targetCoord.x .. ' Y: ' .. targetCoord.y .. ' Z: ' .. targetCoord.z)
 
     env.info('The World Coordinates of the target are: X: ' .. targetCoord.x .. ' Y: ' .. targetCoord.y .. ' Z: ' .. targetCoord.z)
  
|notes= '''Remember''' that the Vec3 x, y and z do ''not'' follow the normal intuitive orientation conventions.  'x' is the north-south axis, 'z' is the east-west axis, and 'y' is the vertical/height axis!
+
|notes= '''Remember''' that the Vec3 x, y and z do ''not'' follow the normal intuitive orientation conventions.  'x' is the north-south axis, 'z' is the east-west axis, and 'y' is the vertical/height axis!  Also, Vec3 x & y to ''not'' correlate to Vec2 x & y!
 
}}
 
}}
 
[[Category:Class Functions|getPoint]]
 
[[Category:Class Functions|getPoint]]
 
[[Category:Game Patch 1.2.0|getPoint]]
 
[[Category:Game Patch 1.2.0|getPoint]]

Revision as of 09:15, 28 January 2023

Scripting Root

Envrioment: Mission Scripting
Function: getPoint Added with: 1.2.0
Member Of: Object, Spot
Syntax: vec3 Object.getPoint(Class Self )
Description: Returns a vec3 table of the x, y, and z coordinates for the position of the given object in 3D space. Coordinates are dependent on the position of the maps origin. In the case of the Caucuses theater, the origin is located in the Crimean region of the map.

Function also works with Unit, Weapon, Static Object, Scenery Object, Airbase


Return Value: vec3
Return Example: Vec3 = {
  x = Distance, 
  y = Distance, 
  z = Distance 
}
Examples: The following prints the target coordinates to the log.
   local targetCoord = Unit.getByName('killMeNow'):getPoint()
   env.info('The World Coordinates of the target are: X: ' .. targetCoord.x .. ' Y: ' .. targetCoord.y .. ' Z: ' .. targetCoord.z)
Related Functions: Object Functions: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir

Spot Functions: createLaser. createInfraRed, destroy, getCategory, getPoint, setPoint, getCode, setCode

Notes: Remember that the Vec3 x, y and z do not follow the normal intuitive orientation conventions. 'x' is the north-south axis, 'z' is the east-west axis, and 'y' is the vertical/height axis! Also, Vec3 x & y to not correlate to Vec2 x & y!