GetCameraMatrix: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 8: Line 8:
<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 cameraX, float cameraY, float cameraZ, float targetX, float targetY, float targetZ, float roll, float fov = getCameraMatrix ( player thePlayer )
</syntaxhighlight>
</syntaxhighlight>


Line 17: Line 17:
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float float float float float float float float getCameraMatrix ( )
float cameraX, float cameraY, float cameraZ, float targetX, float targetY, float targetZ, float roll, float fov = getCameraMatrix ( )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 02:54, 23 August 2012

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).

Syntax

Click to collapse [-]
Server
float cameraX, float cameraY, float cameraZ, float targetX, float targetY, float targetZ, float roll, float fov = getCameraMatrix ( player thePlayer )

Required Arguments

  • thePlayer: The player whose camera matrix is to be returned.
Click to collapse [-]
Client
float cameraX, float cameraY, float cameraZ, float targetX, float targetY, float targetZ, float roll, float fov = getCameraMatrix ( )

Required Arguments

None.

Returns

Returns eight float numbers if the argument(s) are valid; 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 FOV (field of view). Returns false if the arguments are invalid.

Example

Example 1: This clientside example moves camera +1 unit on X axis.

local x, y, z, lx, ly, lz = getCameraMatrix() -- Get the current location and lookat of camera
x, lx = x + 1, lx + 1 -- What will be the new x and x lookat values
setCameraMatrix(x,y,z,lx,ly,lz) -- Set camera to new position

See Also