Difference between revisions of "DCS func getPosition"
From DCS World Wiki - Hoggitworld.com
m (1 revision imported) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 13: | Line 13: | ||
|par4= | |par4= | ||
− | |desc= Returns a | + | |desc= Returns a Position3 table of the objects current position and orientation in 3D space. X, Y, Z values are unit vectors defining the objects orientation. 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 [[DCS_Class_Unit|Unit]], [[DCS_Class_Weapon|Weapon]], [[DCS_Class_Static_Object|Static Object]], [[DCS_Class_Scenery_Object|Scenery Object]], [[DCS_Class_Airbase|Airbase]] | Function also works with [[DCS_Class_Unit|Unit]], [[DCS_Class_Weapon|Weapon]], [[DCS_Class_Static_Object|Static Object]], [[DCS_Class_Scenery_Object|Scenery Object]], [[DCS_Class_Airbase|Airbase]] | ||
− | |rtnType= | + | |rtnType= Position3 |
|rtnExample= Position 3 is a table consisting of the point and orientation tables. | |rtnExample= Position 3 is a table consisting of the point and orientation tables. | ||
Line 40: | Line 40: | ||
[[DCS_Class_Object|'''Object Functions:''']] {{listofScriptingObjectFuncs}} | [[DCS_Class_Object|'''Object Functions:''']] {{listofScriptingObjectFuncs}} | ||
− | |examples= | + | |examples= Assigns a value for the heading and pitch of the unit. |
+ | |||
+ | local unit = Unit.getByName('Bob') | ||
+ | local unitpos = unit:getPosition() | ||
+ | local Heading = math.atan2(unitpos.x.z, unitpos.x.x) | ||
+ | local Pitch = math.asin(unitpos.x.y) | ||
|notes= | |notes= | ||
}} | }} | ||
[[Category:Class Functions|getPosition]] | [[Category:Class Functions|getPosition]] | ||
+ | [[Category:Game Patch 1.2.0|getPosition]] |