SetCameraMatrix

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function sets the camera's position and direction. The first three arguments are the point at which the camera lies, the last three are the point the camera faces (or the point it "looks at").

Note: Calling this function takes the camera's focus away from the player and sets the camera in a fixed position and rotation. The camera's focus can be brought back to the player using the setCameraTarget function.

Syntax

Click to collapse [-]
Server
bool setCameraMatrix ( player thePlayer, float positionX, float positionY, float positionZ [, float lookAtX, float lookAtY, float lookAtZ, float roll = 0, float fov = 70 ] )

OOP Syntax Help! I don't understand this!

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


Required Arguments

  • thePlayer: اللاعب الذي يتم تغيير الكاميرا الخاصة به.
  • positionX: إحداثي x لموضع الكاميرا.
  • positionY: الاحداثيات y لموقع الكاميرا.
  • positionZ: تنسيق z لمكان الكاميرا.
  • Instead of six coordinates, or two vectors, a Matrix can be supplied.

Optional Arguments

  • lookAtX: The x coordinate of the point the camera faces.
  • lookAtY: The y coordinate of the point the camera faces.
  • lookAtZ: The z coordinate of the point the camera faces.
  • roll: The camera roll angle, -180 to 180. A value of 0 means the camera sits straight, positive values will turn it counter-clockwise and negative values will turn it clockwise. -180 or 180 means the camera is upside down.
  • fov: the field of view angle, 0.01 to 180. The higher this value is, the more you will be able to see what is to your sides.
Click to collapse [-]
Client
bool setCameraMatrix ( float positionX, float positionY, float positionZ [, float lookAtX, float lookAtY, float lookAtZ, float roll = 0, float fov = 70 ] )

OOP Syntax Help! I don't understand this!

Note: This is under the static class Camera
Method: Camera.setMatrix(...)
Variable: .matrix
Counterpart: getCameraMatrix


Required Arguments

  • positionX: The x coordinate of the camera's position.
  • positionY: The y coordinate of the camera's position.
  • positionZ: The z coordinate of the camera's position.
  • Instead of six coordinates, or two vectors, a Matrix can be supplied.

Optional Arguments

  • lookAtX: The x coordinate of the point the camera faces.
  • lookAtY: The y coordinate of the point the camera faces.
  • lookAtZ: The z coordinate of the point the camera faces.
  • roll: The camera roll angle, -180 to 180. A value of 0 means the camera sits straight, positive values will turn it counter-clockwise and negative values will turn it clockwise. -180 or 180 means the camera is upside down.
  • fov: the field of view angle, 0.01 to 180. The higher this value is, the more you will be able to see what is to your sides.

Returns

ترجع "true" إذا كانت الحجج صحيحة ، "false" وإلا.

امثلة

يعمل هذا الرمز على تثبيت الكاميرا على علامة Vinewood في Los Santos لأي لاعب ينضم إلى الخادم:

Click to collapse [-]
Server script
function setCameraOnPlayerJoin()
     -- ببطء تتلاشى الكاميرا لجعل الشاشة مرئية
     fadeCamera(source, true, 5)
     -- ضبط كاميرا اللاعب على موضع ثابت ، بالنظر إلى نقطة ثابتة
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
end
addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)

See Also