Camera Tutorial: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "Category:Arma 2: Editing" to "{{GameCategory|arma2|Editing}}")
m (Add more details)
Line 10: Line 10:
The list of all camera commands can be found in the [[:Category:Command Group: Camera Control|Camera command group]] category.
The list of all camera commands can be found in the [[:Category:Command Group: Camera Control|Camera command group]] category.


{{ Important | In '''{{ofp}}''' the "Prepare" commands do not exist.<br>Use their "normal" counterpart instead (e.g [[camPreparePos]] → [[camSetPos]], [[camCommitPrepared]] → [[camCommit]]). }}
{{ Important | In '''{{ofp}}''' the "Prepare" commands do not exist.<br>Use their "normal" counterpart instead (e.g [[camPreparePos]] → [[camSetPos]], [[camCommitPrepared]] → [[camCommit]]).<br>Only [[camCommitted]] is common to both writings.}}


=== Create the camera ===
=== Create the camera ===
  [[private]] _camera = '''[[camCreate]]''' [[getPosATL]] [[player]];
 
  [[private]] _camera = "camera" '''[[camCreate]]''' [[getPosATL]] [[player]];


=== Enter the camera ===
=== Enter the camera ===
  _camera '''[[cameraEffect]]''' ["internal", "back"];
  _camera '''[[cameraEffect]]''' ["internal", "back"];


=== Select a target ===
=== Select a target ===
==== Object target ====
==== Object target ====
  _camera '''[[camPrepareTarget]]''' [[player]]; {{codecomment|// a camera will automatically target the human target's face}}
  _camera '''[[camPrepareTarget]]''' [[player]]; {{codecomment|// a camera will automatically target the human target's face}}
==== Position target ====
==== Position target ====
  _camera '''[[camPrepareTarget]]''' [[getPosATL]] [[player]];
  _camera '''[[camPrepareTarget]]''' [[getPosATL]] [[player]];


=== Place the camera ===
=== Place the camera ===
==== World position ====
==== World position ====
  _camera '''[[camPreparePos]]''' ([[player]] [[getRelPos]] [5, 0]);
  _camera '''[[camPreparePos]]''' ([[player]] [[getRelPos]] [5, 0]);
==== Relative position ====
==== Relative position ====
  _camera '''[[camPrepareRelPos]]''' [0,5,0];
  _camera '''[[camPrepareRelPos]]''' [0,5,0];


=== Apply camera's Field of View ===
=== Apply camera's Field of View ===
  _camera '''[[camPrepareFOV]]''' 0.5; {{codecomment|// standard FOV is 0.7; lesser (e.g 0.5) is zoomed in, greater (e.g 0.9) is zoomed out}}
  _camera '''[[camPrepareFOV]]''' 0.5; {{codecomment|// standard FOV is 0.7; lesser (e.g 0.5) is zoomed in, greater (e.g 0.9) is zoomed out}}


=== Apply all the changes ===
=== Apply all the changes ===
  _camera '''[[camCommitPrepared]]''' 0; {{codecomment|// 0 for immediate change, value in seconds for transition}}
  _camera '''[[camCommitPrepared]]''' 0; {{codecomment|// 0 for immediate change, value in seconds for transition}}


=== Check that the commit happened ===
=== Check that the commit happened ===
  [[camCommitted]] _camera;
  [[camCommitted]] _camera;


=== Leave the camera ===
=== Leave the camera ===
  _camera [[cameraEffect]] ["terminate", "back"];
  _camera [[cameraEffect]] ["terminate", "back"];


=== Delete the camera ===
=== Delete the camera ===
  [[camDestroy]] _camera;
  [[camDestroy]] _camera;
== Specific cases ==
* A camera of bird type (seagull or crowe) '''cannot''' be controlled ''via'' "Prepare" commands - only camSet* ones.
* A camera of bird type is '''always''' [[camCommitted]] even if it is still moving toward its destination.




Line 49: Line 66:


=== Standard example ===
=== Standard example ===
  _camera = "camera" [[camCreate]] [0, 0, 0];
 
  [[private]] _camera = "camera" [[camCreate]] [0, 0, 0];
  _camera [[camPrepareTarget]] player;
  _camera [[camPrepareTarget]] player;
  _camera [[camPrepareRelPos]] [0, -5, 10];
  _camera [[camPrepareRelPos]] [0, -5, 10];
Line 69: Line 87:


=== OFP SQS example ===
=== OFP SQS example ===
  _camera = "camera" [[camCreate]] [0, 0, 0]
  _camera = "camera" [[camCreate]] [0, 0, 0]
  _camera [[camSetTarget]] player
  _camera [[camSetTarget]] player
Line 96: Line 115:


[[Category:Scripting Topics]]
[[Category:Scripting Topics]]
{{GameCategory|arma2|Editing}}
{{GameCategory|arma3|Editing}}
{{GameCategory|arma3|Editing}}
{{GameCategory|arma2|Editing}}
[[Category:Operation Flashpoint: Editing]]
[[Category:ArmA: Editing]]
[[Category:ArmA: Editing]]
[[Category:Operation Flashpoint: Editing]]
{{GameCategory|arma2|Tutorials}}
[[Category:Arma 2: Tutorials]]
{{GameCategory|arma3|Tutorials}}
[[Category:Arma 3: Tutorials]]

Revision as of 23:56, 30 September 2020

Template:SideTOC

Basics

A cinematic camera is what is commonly known as a "cutscene"; the player's input are dismissed and events happen during the video.
A camera is local to the computer where the script has been called; one player could see a cutscene but still get killed by another player that didn't trigger the video.


How to

The list of all camera commands can be found in the Camera command group category.

In Operation Flashpoint the "Prepare" commands do not exist.
Use their "normal" counterpart instead (e.g camPreparePoscamSetPos, camCommitPreparedcamCommit).
Only camCommitted is common to both writings.

Create the camera

private _camera = "camera" camCreate getPosATL player;

Enter the camera

_camera cameraEffect ["internal", "back"];

Select a target

Object target

_camera camPrepareTarget player; // a camera will automatically target the human target's face

Position target

_camera camPrepareTarget getPosATL player;

Place the camera

World position

_camera camPreparePos (player getRelPos [5, 0]);

Relative position

_camera camPrepareRelPos [0,5,0];

Apply camera's Field of View

_camera camPrepareFOV 0.5; // standard FOV is 0.7; lesser (e.g 0.5) is zoomed in, greater (e.g 0.9) is zoomed out

Apply all the changes

_camera camCommitPrepared 0; // 0 for immediate change, value in seconds for transition

Check that the commit happened

camCommitted _camera;

Leave the camera

_camera cameraEffect ["terminate", "back"];

Delete the camera

camDestroy _camera;


Specific cases

  • A camera of bird type (seagull or crowe) cannot be controlled via "Prepare" commands - only camSet* ones.
  • A camera of bird type is always camCommitted even if it is still moving toward its destination.


Full example

Standard example

private _camera = "camera" camCreate [0, 0, 0];
_camera camPrepareTarget player;
_camera camPrepareRelPos [0, -5, 10];
_camera cameraEffect ["internal", "back"];
_camera camCommitPrepared 0;
waitUntil { camCommitted _camera };

_camera camPrepareRelPos [90, 25, 8];
_camera camCommitPrepared 5;
waitUntil { camCommitted _camera };

_camera camPrepareRelPos [-90, -5, 5];
_camera camCommitPrepared 3;
waitUntil { camCommitted _camera };

sleep 3;
_camera cameraEffect ["terminate", "back"];
camDestroy _camera;

OFP SQS example

_camera = "camera" camCreate [0, 0, 0]
_camera camSetTarget player
_camera camSetRelPos [0, -5, 10]
_camera cameraEffect ["internal", "back"]
_camera camCommit 0
@camCommitted _camera

_camera camSetRelPos [90, 25, 8]
_camera camCommit 5
@camCommitted _camera

_camera camSetRelPos [-90, -5, 5]
_camera camCommit 3
@camCommitted _camera

~3
_camera cameraEffect ["terminate", "back"]
camDestroy _camera


See also