Entity::setVelocity: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Note that the third parameter(denoted as z) is 'up and down' with positive numbers encouraging upwards movement.
Note that the third parameter(denoted as z) is 'up and down' with positive numbers encouraging upwards movement.
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">entity.setVelocity(x, y, z);</syntaxhighlight>
<syntaxhighlight lang="javascript">entity.setVelocity(x, y, z);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''x:''' float
*'''x:''' <font color='green'>float</font>
*'''y:''' float
*'''y:''' <font color='green'>float</font>
*'''z:''' float
*'''z:''' <font color='green'>float</font>
 
*<b>Note</b>: that the third parameter(z) is 'up and down' with positive numbers encouraging upwards movement.
 
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
let vehicle = mp.players.local.vehicle
 
let velocity = vehicle.getVelocity(); // returns a object with x, y , z
 
vehicle.setVelocity(velocity.x, velocity.y, velocity.z) // setting the velocity which we got.
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Entity_function_c}}
{{Entity_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]

Latest revision as of 17:54, 1 May 2024

Note that the third parameter(denoted as z) is 'up and down' with positive numbers encouraging upwards movement.

Syntax

entity.setVelocity(x, y, z);

Required Arguments

  • x: float
  • y: float
  • z: float
  • Note: that the third parameter(z) is 'up and down' with positive numbers encouraging upwards movement.

Return value

  • Undefined

Example

let vehicle = mp.players.local.vehicle

let velocity = vehicle.getVelocity(); // returns a object with x, y , z

vehicle.setVelocity(velocity.x, velocity.y, velocity.z) // setting the velocity which we got.

See also