SetCameraMatrix

From Liberty Unleashed Wiki
Revision as of 19:24, 25 September 2011 by Stormeus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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.

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 ] )

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'.

  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.  

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox