Entity::getRotation: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{ClientsideJsFunction}}
{{JSContainer|
<pre>
enum eRotationOrder { // Rotation Orders
    XYZ = 0,
    XZY,
    YXZ,
    YZX,
    ZXY,
    ZYX,
    MAX,
}
</pre>
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">entity.getRotation(rotationOrder);</syntaxhighlight>
<syntaxhighlight lang="javascript">entity.getRotation(rotationOrder);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''rotationOrder:''' {{RageType|Int}} (specifies which axis rotates before the other axis in a certain order)
*'''rotationOrder:''' {{RageType|Int}} (specifies which axis rotates before the other axis in a certain order)
==== Rotation Orders ====
*0: '''ZYX'''
*1: '''YZX'''
*2: '''ZXY'''
*3: '''XZY'''
*4: '''YXZ'''
*5: '''XYZ'''


===Return value===
===Return value===
Line 17: Line 25:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
 
const vehicle = mp.vehicles.at(0);
if (!vehicle || !mp.vehicles.exists(vehicle)) return;
const rotation = vehicle.getRotation(2);
mp.console.logInfo(`Vehicle Rotation: ${JSON.stringify(rotation)}`, false, false);
 
</syntaxhighlight>
</syntaxhighlight>
}}
==See also==
==See also==
{{Entity_function_c}}
{{Entity_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 18:03, 1 May 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


enum eRotationOrder { // Rotation Orders
    XYZ = 0,
    XZY,
    YXZ,
    YZX,
    ZXY,
    ZYX,
    MAX,
}


Syntax

entity.getRotation(rotationOrder);

Required Arguments

  • rotationOrder: Int (specifies which axis rotates before the other axis in a certain order)

Return value

  • Vector3

Example

const vehicle = mp.vehicles.at(0);
if (!vehicle || !mp.vehicles.exists(vehicle)) return;
const rotation = vehicle.getRotation(2);
mp.console.logInfo(`Vehicle Rotation: ${JSON.stringify(rotation)}`, false, false);


See also