GetCameraMatrix: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (fix oop typo)
mNo edit summary
 
(7 intermediate revisions by 6 users not shown)
Line 3: Line 3:
This function gets the position of the camera and the position of the point it is facing.
This function gets the position of the camera and the position of the point it is facing.


Note: The server-side version of this function returns the last camera matrix that was set by the server, and thus does not necessarily indicate the current matrix of the camera (since it may have been changed client-side).


==Procedural==
{{Important Note|Server-side this functions returns false or the latest value set via [[setCameraMatrix]] (called from server or client).}}
 
==Syntax==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float float float float float float float float getCameraMatrix (player thePlayer)
float float float float float float float float getCameraMatrix ( player thePlayer )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[player]]:getCameraMatrix|cameraMatrix|setCameraMatrix}}
{{OOP||[[player]]:getCameraMatrix|cameraMatrix|setCameraMatrix}}
Line 20: Line 21:
float float float float float float float float getCameraMatrix ()
float float float float float float float float getCameraMatrix ()
</syntaxhighlight>
</syntaxhighlight>
{{OOP|This is under the static class '''Camera'''|[[Camera]].getMatrix|matrix|setCameraMatrix}}
{{OOP||[[Camera]].getMatrix|matrix|setCameraMatrix}}
</section>
</section>


===Returns===
This function returns 8 [[float|floats]] if the argument is valid (when applicable); the first three indicate the position of the camera, the next three indicate the position of the point it's facing, and the last two are the roll and field of view. Returns ''false'' if the argument is invalid.
This function returns 8 [[float|floats]] if the argument is valid (when applicable); the first three indicate the position of the camera, the next three indicate the position of the point it's facing, and the last two are the roll and field of view. Returns ''false'' if the argument is invalid.


Line 34: Line 36:
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
{{New items|3.0140|1.4|
==Object-oriented==
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
Matrix player:getCameraMatrix()
--or
Matrix player.cameraMatrix -- to get the camera matrix value
player.cameraMatrix = Matrix -- to set the camera matrix value
</syntaxhighlight>
</section>
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
Matrix Camera.getMatrix ()
</syntaxhighlight>
</section>
This function returns a matrix with the position of the camera (first three elements), the position of the point it's facing (next three elements) and the roll and field of view (last two elements) if the function is successful. Returns an empty matrix otherwise.
===Example===
This page lacks an example.
}}


==See Also==
==See Also==
{{Camera functions}}
{{Camera functions}}
[[hu:getCameraMatrix]]
[[RO:getCameraMatrix]]

Latest revision as of 08:03, 10 October 2020

This function gets the position of the camera and the position of the point it is facing.


[[{{{image}}}|link=|]] Important Note: Server-side this functions returns false or the latest value set via setCameraMatrix (called from server or client).

Syntax

Click to collapse [-]
Server
float float float float float float float float getCameraMatrix ( player thePlayer )

OOP Syntax Help! I don't understand this!

Method: player:getCameraMatrix(...)
Variable: .cameraMatrix
Counterpart: setCameraMatrix


Required Arguments

  • thePlayer: The player whose camera matrix is to be returned.
Click to collapse [-]
Client
float float float float float float float float getCameraMatrix ()

OOP Syntax Help! I don't understand this!

Method: Camera.getMatrix(...)
Variable: .matrix
Counterpart: setCameraMatrix


Returns

This function returns 8 floats if the argument is valid (when applicable); the first three indicate the position of the camera, the next three indicate the position of the point it's facing, and the last two are the roll and field of view. Returns false if the argument is invalid.

Example

Click to collapse [-]
Client
local x, y, z, lx, ly, lz = getCameraMatrix ()
x, lx = x + 1, lx + 1

setCameraMatrix (x, y, z, lx, ly, lz)

See Also