Squirrel/Server/Functions/Camera/SetCameraMatrix

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

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:

  1. bool SetCameraMatrix( Player plr, Vector pos, Vector lookat, [ Vector rot ] )
  1. 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'.

  1.  
  2. function onPlayerCommand( player, command, text )
  3. {
  4. if ( command == "cam" )
  5. {
  6. local v1 = Vector( 1499.57, -206.88, 55.0 );
  7. local v2 = Vector( 1499.57, -209.46, 55.0 );
  8. SetCameraMatrix( player, v1, v2 );
  9. }
  10. return 1;
  11. }
  12.  

[edit] Notes

The event onPlayerCommand was used in this example. More info about it in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox