Camera Tutorial: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 17: | Line 17: | ||
=== Create the camera === | === Create the camera === | ||
<sqf>private _camera = "camera" camCreate getPosATL player;</sqf> | |||
=== Enter the camera === | === Enter the camera === | ||
<sqf>_camera cameraEffect ["internal", "back"];</sqf> | |||
=== Select a target === | === Select a target === | ||
==== Object target ==== | ==== Object target ==== | ||
<sqf>_camera camPrepareTarget player; // a camera will automatically target the human target's face</sqf> | |||
==== Position target ==== | ==== Position target ==== | ||
<sqf>_camera camPrepareTarget getPosATL player;</sqf> | |||
=== Place the camera === | === Place the camera === | ||
==== World position ==== | ==== World position ==== | ||
<sqf>_camera camPreparePos (player getRelPos [5, 0]);</sqf> | |||
==== Relative position ==== | ==== Relative position ==== | ||
<sqf> | |||
_camera camCommitPrepared 0; // required to apply the prepared target first - otherwise a long trip from [0,0,0] is to follow | |||
_camera camPrepareRelPos [0,5,0]; | |||
</sqf> | |||
=== Apply camera's Field of View === | === Apply camera's Field of View === | ||
<sqf>_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</sqf> | |||
=== Apply all the changes === | === Apply all the changes === | ||
==== Immediately or with transition ==== | ==== Immediately or with transition ==== | ||
<sqf>_camera camCommitPrepared 0; // 0 for immediate change, value in seconds for transition</sqf> | |||
==== With a loading timeout ==== | ==== With a loading timeout ==== | ||
<sqf> | |||
_camera camPreload 3; // since Armed Assault - instantly moves the camera once preload or timeout is done. | |||
// tells the game to preload the future field of view. 3 here is a timeout, 0 for infinite timeout | |||
</sqf> | |||
=== Check that the commit happened === | === Check that the commit happened === | ||
<sqf>camCommitted _camera; // for camCommit/camCommitPrepared usage</sqf> | |||
<sqf>camPreloaded _camera; // for camPreload usage</sqf> | |||
=== Leave the camera === | === Leave the camera === | ||
<sqf>_camera cameraEffect ["terminate", "back"];</sqf> | |||
=== Delete the camera === | === Delete the camera === | ||
<sqf>camDestroy _camera;</sqf> | |||
Line 78: | Line 82: | ||
=== Standard example === | === Standard example === | ||
<sqf> | |||
private _camera = "camera" camCreate [0, 0, 0]; | |||
_camera camPrepareTarget player; | |||
_camera camCommitPrepared 0; // needed for relative position | |||
_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; | |||
</sqf> | |||
=== {{ofp}} SQS example === | === {{ofp}} SQS example === | ||
<sqs> | |||
_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 | |||
</sqs> | |||
Revision as of 11:44, 22 July 2022
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.
Create the camera
Enter the camera
Select a target
Object target
Position target
Place the camera
World position
Relative position
_camera camCommitPrepared 0; // required to apply the prepared target first - otherwise a long trip from [0,0,0] is to follow
_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
Immediately or with transition
With a loading timeout
_camera camPreload 3; // since Armed Assault - instantly moves the camera once preload or timeout is done.
// tells the game to preload the future field of view. 3 here is a timeout, 0 for infinite timeout
Check that the commit happened
Leave the camera
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 committed (camCommitted will always return true) even if it is still moving toward its destination.
Full example
Standard example
private _camera = "camera" camCreate [0, 0, 0];
_camera camPrepareTarget player;
_camera camCommitPrepared 0; // needed for relative position
_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;
Operation Flashpoint 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