Streaming::setFocusPosAndVel: Difference between revisions

From RAGE Multiplayer Wiki
m (Help to clear focus after use)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Override the area where the camera will render the terrain.<br>p3, p4 and p5 are usually set to 0.0<br>
Override the area where the camera will render the terrain. After moving to another area, you need to clear focus. This can be done using the following native [[Streaming::clearFocus]]
 
'''After moving to another area, you need to clear focus. This can be done using the following native:'''
<syntaxhighlight lang="javascript">mp.game.invoke('0x31B73D1EA9F01DA2');</syntaxhighlight>
 


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">mp.game.streaming.setFocusArea(x, y, z, offsetX, offsetY, offsetZ);</syntaxhighlight>
<syntaxhighlight lang="javascript">mp.game.streaming.setFocusPosAndVel(x, y, z, velocityX, velocityY, velocityZ);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''x:''' float
*'''x:''' float
*'''y:''' float
*'''y:''' float
*'''z:''' float
*'''z:''' float
*'''offsetX:''' float
*'''velocityX:''' float
*'''offsetY:''' float
*'''velocityY:''' float
*'''offsetZ:''' float
*'''velocityZ:''' float
===Return value===
===Return value===
*'''Undefined'''
*'''Undefined'''
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
const position = new mp.Vector3();
mp.game.streaming.setFocusPosAndVel(position.x, position.y, position.z, 0, 0, 0);
 
// Wait till it's loaded
mp.game.streaming.newLoadSceneStartSphere(position.x, position.y, position.z, 30, 0);
 
while (!mp.game.streaming.isNewLoadSceneLoaded()) {
    await mp.game.waitAsync(0);
}
 
mp.game.streaming.newLoadSceneStop();
 
// Your code
 
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Streaming_s_function_c}}
{{Streaming_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 03:35, 27 May 2024

Override the area where the camera will render the terrain. After moving to another area, you need to clear focus. This can be done using the following native Streaming::clearFocus

Syntax

mp.game.streaming.setFocusPosAndVel(x, y, z, velocityX, velocityY, velocityZ);

Required Arguments

  • x: float
  • y: float
  • z: float
  • velocityX: float
  • velocityY: float
  • velocityZ: float

Return value

  • Undefined

Example

const position = new mp.Vector3();
mp.game.streaming.setFocusPosAndVel(position.x, position.y, position.z, 0, 0, 0);

// Wait till it's loaded
mp.game.streaming.newLoadSceneStartSphere(position.x, position.y, position.z, 30, 0);

while (!mp.game.streaming.isNewLoadSceneLoaded()) {
    await mp.game.waitAsync(0);
}

mp.game.streaming.newLoadSceneStop();

// Your code

See also