Camera Tutorial: Difference between revisions
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) (Add PiP info) |
||
Line 53: | Line 53: | ||
==== With a loading timeout ==== | ==== With a loading timeout ==== | ||
<sqf> | <sqf> | ||
_camera camPreload 3; // since Armed Assault - instantly | _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 | // tells the game to preload the future field of view. 3 here is a timeout, 0 for infinite timeout | ||
</sqf> | </sqf> | ||
Line 80: | Line 80: | ||
== Full example == | == Full example == | ||
== | {| class="wikitable" | ||
! style="width: 50%" | [[SQF Syntax]] | |||
! [[SQS Syntax]] | |||
|- | |||
| | |||
<sqf> | <sqf> | ||
private _camera = "camera" camCreate [0, 0, 0]; | private _camera = "camera" camCreate [0, 0, 0]; | ||
Line 104: | Line 107: | ||
</sqf> | </sqf> | ||
| | |||
<sqs> | <sqs> | ||
_camera = "camera" camCreate [0, 0, 0] | _camera = "camera" camCreate [0, 0, 0] | ||
_camera camSetTarget player | _camera camSetTarget player | ||
_camera camSetRelPos [0, -5, 10] | _camera camSetRelPos [0, -5, 10] | ||
_camera cameraEffect ["internal", "back"] | _camera cameraEffect ["internal", "back"] | ||
Line 126: | Line 130: | ||
camDestroy _camera | camDestroy _camera | ||
</sqs> | </sqs> | ||
|} | |||
== Picture-in-Picture == | |||
=== Create Source === | |||
The Picture-in-Picture (PiP) RTT (or R2T, Render to Texture) source can be defined at the {{Link|#Enter the camera}} step; instead of | |||
<sqf>_camera cameraEffect ["internal", "back"];</sqf> | |||
use the following to create a PiP source - multiple sources can be | |||
<sqf>_camera cameraEffect ["internal", "back", "rttName"];</sqf> | |||
=== Configure PiP Effects === | |||
A camera effect is set using [[setPiPEffect]] as such: | |||
<sqf>"rttName" setPiPEffect [2]; // sets thermal imaging</sqf> | |||
Once all the configuration is done, the PiP texture can be accessed by referencing its name "rttName". For example: | |||
<sqf> | |||
if (!isPiPEnabled) exitWith { systemChat "PiP is not enabled in video options"; }; | |||
with uiNamespace do // or use disableSerialization | |||
{ | |||
private _ctrl = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscPicture", -1]; | |||
_ctrl ctrlSetPosition [safeZoneW * 0.75, safeZoneY, safeZoneW * 0.25, safeZoneH * 0.25]; | |||
_ctrl ctrlSetText "#(argb,512,512,1)r2t(rttName,1.0)"; | |||
_ctrl ctrlCommit 0; | |||
}; | |||
</sqf> | |||
In order to stop the camera from "broadcasting", use | |||
<sqf> | |||
_camera cameraEffect ["terminate", "back", "rttName"]; // terminates "rttName" r2t source | |||
_camera cameraEffect ["terminate", "back"]; // terminates all r2t source | |||
</sqf> | |||
The camera still exists until destroyed with [[camDestroy]]. | |||
Line 132: | Line 173: | ||
* [[Camera.sqs]] | * [[Camera.sqs]] | ||
* [[Arma 3: Splendid Camera]] / [[BIS_fnc_camera]] | * [[Arma 3: Splendid Camera]] / [[BIS_fnc_camera]] | ||
* [[:Category:Command Group: Camera Control|Command Group: Camera Control]] | |||
* [[BIS_fnc_PIP]] | |||
[[Category:Arma Scripting Tutorials]] | [[Category:Arma Scripting Tutorials]] |
Latest revision as of 19:04, 29 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
Apply camera's Field of View
Apply all the changes
Immediately or with transition
With a loading timeout
Check that the commit happened
Leave the camera
Delete the 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
SQF Syntax | SQS Syntax |
---|---|
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; |
_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 |
Picture-in-Picture
Create Source
The Picture-in-Picture (PiP) RTT (or R2T, Render to Texture) source can be defined at the Enter the camera step; instead of
use the following to create a PiP source - multiple sources can be
Configure PiP Effects
A camera effect is set using setPiPEffect as such:
Once all the configuration is done, the PiP texture can be accessed by referencing its name "rttName". For example:
In order to stop the camera from "broadcasting", use
The camera still exists until destroyed with camDestroy.