Page tree
Skip to end of metadata
Go to start of metadata

Cameras can be used in cut-scenes, or to show views that are different from that of the current player.

To start a camera you need at least the following two commands:

// Creates a camera behind the player, 2m offset to the right
_camera = "camera" camCreate (player modelToWorld [2,-2,1.5]);

// Camera can be moved around, and otherwise manipulated. 
_camera cameraEffect ["Internal", "Back"];

The following part is the "action" of the camera, and will be different, depending on what is to be achieved. In this example, we do a pan alongside the player.

// the camera will always point at the player
_camera camSetTarget player;
// the first targeting will happen immediately
_camera camCommit 0;

for "_y" from -5 to 5 do {
  // we move the camera from 5m behind the player to 5m in front of him
  _camera camSetPos (player modelToWorld [2,_y,1.5]);
  // each move will take 1 second
  _camera camCommit 1;
  // wait until each move has been completed
  waitUntil {camCommitted _camera};
// wait a bit, before terminating the camera
sleep 2;

Once the camera sequence has finished, the camera has to be terminated with the following two commands:

_camera cameraEffect ["Terminate", "BACK"];
camDestroy _camera;

Cameras can also be created and controlled (via waypoints) as an editor object.
For more information, see Camera Editor Object in the VBS3 Editor Manual.


Reference Pages

Camera Commands