getCameraMatrix | Multi Theft Auto: Wiki Skip to content

getCameraMatrix

Client-side
Server-side
Shared

Pair: setCameraMatrix

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

Important

Server-side this functions returns false or the latest value set via setCameraMatrix (called from server or client.) So if you never used setCameraMatrix on serverside for that player, then it will return false.

OOP Syntax Help! I don't understand this!

Server OOP syntax
  • Method:player:getCameraMatrix(...)
  • Variable: .matrix
Client OOP syntax
  • Method:Camera.getMatrix(...)
  • Variable: .matrix

Client Syntax

float|false,​ float,​ float,​ float,​ float,​ float,​ float,​ float getCameraMatrix ( )

Returns

  • float|false: positionX
  • float: positionY
  • float: positionZ
  • float: lookAtX
  • float: lookAtY
  • float: lookAtZ
  • float: roll
  • float: fov

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.

Server Syntax

float|false,​ float,​ float,​ float,​ float,​ float,​ float,​ float getCameraMatrix ( player thePlayer )
Required Arguments
  • thePlayer: The player whose camera matrix is to be returned.

Returns

  • float|false: positionX
  • float: positionY
  • float: positionZ
  • float: lookAtX
  • float: lookAtY
  • float: lookAtZ
  • float: roll
  • float: fov

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.

Code Examples

client
local x, y, z, lx, ly, lz = getCameraMatrix()
x, lx = x + 1, lx + 1
setCameraMatrix(x, y, z, lx, ly, lz)