Squirrel/Server/Functions/Camera/SetCameraMatrix
From Liberty Unleashed Wiki
(Difference between revisions)
m (why the hell did i press save page?) |
m (Fixed link) |
||
Line 1: | Line 1: | ||
{{Squirrel/Title|SetCameraMatrix}} | {{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 from the player. Focus can be returned to the player using function [[Squirrel/Server/Functions/RestoreCamera|RestoreCamera]]. | + | 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 [[Squirrel/Server/Functions/Camera/RestoreCamera|RestoreCamera]]. |
== Syntax == | == Syntax == |
Latest revision as of 20:24, 25 September 2011
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.
[edit] 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 ] )
[edit] 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
[edit] 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; }
[edit] Notes
The event onPlayerCommand was used in this example. More info about it in the corresponding page.
[edit] Related Functions
- FadeCamera
- GetCinematicBorder
- RestoreCamera
- ShakeCamera
- SetCameraMatrix
- SetCinematicBorder