locationPosition: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ")
(Fix return value)
 
(15 intermediate revisions by the same user not shown)
Line 20: Line 20:
|descr= Returns the [[Position|position]] of a location. If the location is attached to an object, that object's position is returned.
|descr= Returns the [[Position|position]] of a location. If the location is attached to an object, that object's position is returned.


|s1= '''locationPosition''' location
|s1= [[locationPosition]] location


|p1= location: [[Location]]
|p1= location: [[Location]]


|r1= [[Array]] - format [x,y,z], where z is <tt>-1 * [[getTerrainHeightASL]]</tt> at the location
|r1= [[Array]] format [[Position#PositionAGL|PositionAGL]] - as locations are placed at Z = zero [[Position#PositionASL|ASL]] the returned Z is negative on land and around zero on water, see {{Link|#Example 3}}


|x1= <code>_locationPos = [[locationPosition]] myLocation;</code>
|x1= <sqf>_locationPos = locationPosition myLocation;</sqf>


|x2= <code>_location = [[nearestLocation]] [<nowiki/>[[getPos]] [[player]], "nameCity"];
|x2= <sqf>
_locationPos = [[locationPosition]] _location;</code>
_location = nearestLocation [getPos player, "nameCity"];
_locationPos = locationPosition _location;
</sqf>


|seealso= [[setPosition]], [[createLocation]], [[nearestLocation]], [[nearestLocations]], [[position]], [[size]]
|x3= <sqf>
private _landLocation = locationPosition nearestLocation [[2915.2, 6164.52], "NameCityCapital"]; // "Agia Marina" [2915.2, 6164.52, -21.9009]
private _waterLocation = locationPosition nearestLocation [[2647.8799, 5989.9502], "NameMarine"]; // "Marina Bay" [2647.88, 5989.95, 0.0161484]
</sqf>
 
|seealso= [[setPosition]] [[createLocation]] [[nearestLocation]] [[nearestLocations]] [[position]] [[size]]
}}
}}

Latest revision as of 22:25, 11 April 2023

Hover & click on the images for description

Description

Description:
Returns the position of a location. If the location is attached to an object, that object's position is returned.
Groups:
Locations

Syntax

Syntax:
locationPosition location
Parameters:
location: Location
Return Value:
Array format PositionAGL - as locations are placed at Z = zero ASL the returned Z is negative on land and around zero on water, see Example 3

Examples

Example 1:
_locationPos = locationPosition myLocation;
Example 2:
_location = nearestLocation [getPos player, "nameCity"]; _locationPos = locationPosition _location;
Example 3:
private _landLocation = locationPosition nearestLocation [[2915.2, 6164.52], "NameCityCapital"]; // "Agia Marina" [2915.2, 6164.52, -21.9009] private _waterLocation = locationPosition nearestLocation [[2647.8799, 5989.9502], "NameMarine"]; // "Marina Bay" [2647.88, 5989.95, 0.0161484]

Additional Information

See also:
setPosition createLocation nearestLocation nearestLocations position size

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note