Squirrel/Server/Functions/Camera/SetCameraMatrix
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|SetCameraMatrix}} This function changes the position and direction of the camera for a player. ''Note:'' Using this function will take the camera's focus away fr…') |
m (why the hell did i press save page?) |
||
Line 29: | Line 29: | ||
local v1 = Vector( 1499.57, -206.88, 55.0 ); | local v1 = Vector( 1499.57, -206.88, 55.0 ); | ||
local v2 = Vector( 1499.57, -209.46, 55.0 ); | local v2 = Vector( 1499.57, -209.46, 55.0 ); | ||
− | + | ||
+ | SetCameraMatrix( player, v1, v2 ); | ||
} | } | ||
Revision as of 03:08, 25 September 2010
This function changes the position and direction of the camera for a player. Note: Using this function will take the camera's focus away from the player. Focus can be returned to the player using function RestoreCamera.
Syntax
SetCameraMatrix can take different lists of parameters:
bool SetCameraMatrix( Player plr, Vector pos, Vector lookat, [ Vector rot ] )
bool SetCameraMatrix( Player plr, float posx, float posy, float posz, float lookatx, float lookaty, float lookatz, [ float rot1, float rot2 ] )
Arguments
- plr - The player to set the camera matrix for
- pos - Position of the camera as a vector
- lookat - The point where the camera will target at as a vector
- rot - Camera's rotation angles as a vector. Note that only the first two values will affect the camera rotation
- posx, posy, posz - Position of the camera as floats
- lookatx, lookaty, lookatz - The point where the camera will target at as floats
- rot1, rot2 - Camera's rotation angles as floats
Example
This function will move the player's camera to the default spawn screen position when they type '/cam'.
function onPlayerCommand( player, command, text ) { if ( command == "cam" ) { local v1 = Vector( 1499.57, -206.88, 55.0 ); local v2 = Vector( 1499.57, -209.46, 55.0 ); SetCameraMatrix( player, v1, v2 ); } return 1; }
Notes
The event onPlayerCommand was used in this example. More info about it in the corresponding page.
Related Functions
- FadeCamera
- GetCinematicBorder
- RestoreCamera
- ShakeCamera
- SetCameraMatrix
- SetCinematicBorder