Graphics::screen2dToWorld3d: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
m (inverted function reference)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
Returns world position from screen position
Returns world position from screen position
Inverted function: [[Graphics::world3dToScreen2d]]
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
mp.game.graphics.screen2dToWorld3d(x, y[, test]);</syntaxhighlight>
mp.game.graphics.screen2dToWorld3d(coords2d);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''x:''' int
*'''Vector3:''' 2d coord
*'''y:''' int
===Return value===
===Return value===
*'''position:''' Vector3
*'''position:''' Vector3
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
let pos3d = mp.game.graphics.screen2dToWorld3d(new mp.Vector3(screenX, screenY, 0));
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==

Latest revision as of 19:25, 22 August 2020

Returns world position from screen position

Inverted function: Graphics::world3dToScreen2d

Syntax

mp.game.graphics.screen2dToWorld3d(coords2d);

Required Arguments

  • Vector3: 2d coord

Return value

  • position: Vector3

Example

let pos3d = mp.game.graphics.screen2dToWorld3d(new mp.Vector3(screenX, screenY, 0));

See also