Entity::getHeightAboveGround: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
 
Line 1: Line 1:
Return height (z-dimension) above ground. <br>Example: The pilot in a titan plane is 1.844176 above ground.<br><br>How can i convert it to meters?<br>Everything seems to be in meters, probably this too.
{{ClientsideJsFunction}}
==Syntax==
{{JSContainer|
<syntaxhighlight lang="javascript">entity.getHeightAboveGround();</syntaxhighlight>
 
=== Required Arguments ===
The `getHeightAboveGround` function returns the entity’s height above the ground level in meters, making it straightforward to interpret the result as a metric measurement. This function can be useful for determining altitude in various gameplay scenarios, such as checking if a player or vehicle is flying above a certain threshold.
===Return value===
 
*'''float'''
=== Required Params ===
==Example==
* '''None'''
 
=== Return Value ===
* '''float''' – Height in meters above ground level.
 
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
entity.getHeightAboveGround();
</syntaxhighlight>
</syntaxhighlight>
==See also==
 
== Example ==
<syntaxhighlight lang="javascript">
// Example usage of getHeightAboveGround
 
let heightAboveGround = mp.players.local.getHeightAboveGround();
mp.gui.chat.push("Height above ground: " + heightAboveGround.toFixed(2) + " meters");
</syntaxhighlight>
 
== See Also ==
{{Entity_definition_c}}
{{Entity_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:Entity API]]
}}

Latest revision as of 10:55, 2 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


The `getHeightAboveGround` function returns the entity’s height above the ground level in meters, making it straightforward to interpret the result as a metric measurement. This function can be useful for determining altitude in various gameplay scenarios, such as checking if a player or vehicle is flying above a certain threshold.

Required Params

  • None

Return Value

  • float – Height in meters above ground level.

Syntax

entity.getHeightAboveGround();

Example

// Example usage of getHeightAboveGround

let heightAboveGround = mp.players.local.getHeightAboveGround();
mp.gui.chat.push("Height above ground: " + heightAboveGround.toFixed(2) + " meters");

See Also