SetCameraMatrix: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
هذه الوظيفة تغير مكان الكاميرا. اول ثلاثة ارقمنات يعبرون عن احداثيات مكان الكاميرا, اخر ثلاثة ارقمنات يعبرون عن مكان اتجاه الكاميرا اي يعني ماتنظر اليه الكاميرا.
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").


'''ملحوظة:''' استدعاء هذه الوظيفة سيحرك كاميرا الاعب الي موضع واتجاه مختلف لاعاده الكاميرا الي الاعب يمكنك استخدام وظيفة [[setCameraTarget]]
'''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==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 10: Line 10:
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[player]]:setCameraMatrix|cameraMatrix|getCameraMatrix}}
{{OOP||[[player]]:setCameraMatrix|cameraMatrix|getCameraMatrix}}
===الارقمنات المطلوبة===  
===Required Arguments===  
*'''thePlayer:''' الاعب الذي ستتغير مكان او اتجاه الكاميرا لديه.
*'''thePlayer:''' The player whose camera is to be changed.
*'''positionX:''' احداثي اكس لمكان الكاميرا.
*'''positionX:''' The x coordinate of the camera's position.
*'''positionY:''' احداثي واي لمكان الكاميرا.
*'''positionY:''' The y coordinate of the camera's position.
*'''positionZ:''' احداثي زد لمكان الكاميرا.
*'''positionZ:''' The z coordinate of the camera's position.
*'''{{New feature/item|3.0141|1.4.1|7005|Instead of six coordinates, or two vectors, a Matrix can be supplied.}}'''
*'''{{New feature/item|3.0141|1.4.1|7005|Instead of six coordinates, or two vectors, a Matrix can be supplied.}}'''


===الارقمنات الاختيارية===  
===Optional Arguments===  
*'''lookAtX:''' احداثي اكس لاتجاه الكاميرا.
*'''lookAtX:''' The x coordinate of the point the camera faces.
*'''lookAtY:''' احداثي واي لاتجاه الكاميرا.
*'''lookAtY:''' The y coordinate of the point the camera faces.
*'''lookAtZ:''' احداثي زد لاتجاه الكاميرا.
*'''lookAtZ:''' The z coordinate of the point the camera faces.
*'''roll:''' زاوية تمايل الكاميرا, من -180 ال 180. اذا كانت القيمة ب 0 ستكون الكاميرا مستقيمة, القيم الإيجابية سوف تتحول عكس اتجاه عقارب الساعة والقيم السلبية سوف تتحول في اتجاه عقارب الساعة. -180 او 180 تعني ان الكاميرا ستكون راس علي عقب.
*'''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:''' مجال زاوية الرؤية, 0 الي 180 . كلما ارتفعت هذه القيمة , كلما استطعت رؤية مجال اكبر
*'''fov:''' the field of view angle, 0 to 180. The higher this value is, the more you will be able to see what is to your sides.
</section>
</section>


Line 31: Line 31:
{{OOP|This is under the static class '''Camera'''|Camera.setMatrix|matrix|getCameraMatrix}}
{{OOP|This is under the static class '''Camera'''|Camera.setMatrix|matrix|getCameraMatrix}}


===الارقمنات المطلوبة===  
===Required Arguments===  
*'''positionX:''' احداثي اكس لمكان الكاميرا.
*'''positionX:''' The x coordinate of the camera's position.
*'''positionY:''' احداثي واي لمكان الكاميرا.
*'''positionY:''' The y coordinate of the camera's position.
*'''positionZ:''' احداثي زد لمكان الكاميرا.
*'''positionZ:''' The z coordinate of the camera's position.
*'''{{New feature/item|3.0141|1.4.1|7005|Instead of six coordinates, or two vectors, a Matrix can be supplied.}}'''
*'''{{New feature/item|3.0141|1.4.1|7005|Instead of six coordinates, or two vectors, a Matrix can be supplied.}}'''


===الارقمنات الاختيارية===  
===Optional Arguments===  
*'''lookAtX:''' احداثي اكس لاتجاه الكاميرا.
*'''lookAtX:''' The x coordinate of the point the camera faces.
*'''lookAtY:''' احداثي واي لاتجاه الكاميرا.
*'''lookAtY:''' The y coordinate of the point the camera faces.
*'''lookAtZ:''' احداثي زد لاتجاه الكاميرا.
*'''lookAtZ:''' The z coordinate of the point the camera faces.
*'''roll:''' زاوية تمايل الكاميرا, من -180 ال 180. اذا كانت القيمة ب 0 ستكون الكاميرا مستقيمة, القيم الإيجابية سوف تتحول عكس اتجاه عقارب الساعة والقيم السلبية سوف تتحول في اتجاه عقارب الساعة. -180 او 180 تعني ان الكاميرا ستكون راس علي عقب.
*'''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:''' مجال زاوية الرؤية, 0 الي 180 . كلما ارتفعت هذه القيمة , كلما استطعت رؤية مجال اكبر
*'''fov:''' the field of view angle, 0 to 180. The higher this value is, the more you will be able to see what is to your sides.
</section>
</section>


Line 48: Line 48:
Returns ''true'' if the arguments are valid, ''false'' otherwise.
Returns ''true'' if the arguments are valid, ''false'' otherwise.


==مثال==
==Example==
هذا الكود يضع اتجاه ومكان الكاميرا علي علامة "فاين وود" في مدينة لوس سانتوس لاي لاعب يدخل الي السيرفر :
هذا الكود يضع اتجاه ومكان الكاميرا علي علامة " Vinewood " في مدينة لوس سانتوس لاي لاعب يدخل الي السيرفر .
<section class="server" name="Server script" show="true">
<section class="server" name="Server script" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function setCameraOnPlayerJoin()
function setCameraOnPlayerJoin()
     -- تتلاشي الكاميرا ببطئ لتجعل الشاشة مرئية
     -- slowly fade the camera in to make the screen visible
     fadeCamera(source, true, 5)
     fadeCamera(source, true, 5)
     -- تضع كاميرا الخاصة بلاعب ف مكان معين, وتنظر الي اتجاه معين
     -- set the player's camera to a fixed position, looking at a fixed point
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
end
end
Line 61: Line 61:
</section>
</section>


==انظر ايضا==
==See Also==
{{Camera functions}}
{{Camera functions}}

Revision as of 01:12, 9 April 2017

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: The player whose camera is to be changed.
  • 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 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 to 180. The higher this value is, the more you will be able to see what is to your sides.

Returns

Returns true if the arguments are valid, false otherwise.

Example

هذا الكود يضع اتجاه ومكان الكاميرا علي علامة " Vinewood " في مدينة لوس سانتوس لاي لاعب يدخل الي السيرفر .

Click to collapse [-]
Server script
function setCameraOnPlayerJoin()
     -- slowly fade the camera in to make the screen visible
     fadeCamera(source, true, 5)
     -- set the player's camera to a fixed position, looking at a fixed point
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
end
addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)

See Also