camSetDir: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
mNo edit summary
 
(20 intermediate revisions by 2 users not shown)
Line 28: Line 28:
|eff= local
|eff= local


|descr= Sets the orientation of the given camera in the direction of the given vector. Needs [[camCommit]].
|descr= Sets the orientation of the given camera in the direction of the given vector. Needs [[camCommit]]. Since {{GVI|arma3|0.50}}, only the second syntax with a [[Vector3D]] is available.


|s1= camera [[camSetDir]] direction
|s1= camera [[camSetDir]] azimuth


|p1= camera: [[Object]] - object of type "camera"
|p1= camera: [[Object]] - object of type "camera"


|p2= direction:
|p2= azimuth: [[Number]] - camera azimuth
* [[Number]] (before {{GVI|arma3|0.50}}) - camera azimuth
* [[Array]] in format [x,y,z] (since {{GVI|arma3|0.50}}) - direction of camera. Must be a valid vector.


|r1= [[Nothing]]
|r1= [[Nothing]]
|s2= camera [[camSetDir]] direction
|s2since= arma3 0.50
|p21= camera: [[Object]] - object of type "camera"
|p22= direction: [[Vector3D]] - direction of camera. Must be a valid vector.
|r2= [[Nothing]]


|x1= Since {{arma3}}:
|x1= Since {{arma3}}:
<code>private _pos1 = player modelToWorld [0, 5, 5];
<sqf>
private _pos1 = player modelToWorld [0, 5, 5];
private _pos2 = player modelToWorld [0, 50, 50];
private _pos2 = player modelToWorld [0, 50, 50];


private _cam = "camera" [[camCreate]] _pos1;
private _cam = "camera" camCreate _pos1;
_cam [[cameraEffect]] ["INTERNAL", "BACK"];
_cam cameraEffect ["INTERNAL", "BACK"];


_cam [[camSetPos]] _pos2;
_cam camSetPos _pos2;
_cam [[camSetDir]] (_pos2 [[vectorFromTo]] _pos1);
_cam camSetDir (_pos2 vectorFromTo _pos1);
_cam [[camCommit]] 5;
_cam camCommit 5;
[[waitUntil]] { [[camCommitted]] _cam };
waitUntil { camCommitted _cam };


_cam [[camSetPos]] _pos1;
_cam camSetPos _pos1;
_cam [[camCommit]] 5;</code>
_cam camCommit 5;
</sqf>


|x2= Before {{arma3}}:
|x2= Before {{arma3}}:
<code>private _pos1 = player modelToWorld [0, 5, 5];
<sqf>
private _pos1 = player modelToWorld [0, 5, 5];
private _pos2 = player modelToWorld [0, 50, 50];
private _pos2 = player modelToWorld [0, 50, 50];


private _cam = "camera" [[camCreate]] _pos1;
private _cam = "camera" camCreate _pos1;
_cam [[cameraEffect]] ["INTERNAL", "BACK"];
_cam cameraEffect ["INTERNAL", "BACK"];


_cam [[camSetPos]] _pos2;
_cam camSetPos _pos2;
_cam [[camSetDir]] 180;
_cam camSetDir 180;
_cam [[camCommit]] 5;
_cam camCommit 5;
[[waitUntil]] { [[camCommitted]] _cam };
waitUntil { camCommitted _cam };


_cam [[camSetPos]] _pos1;
_cam camSetPos _pos1;
_cam [[camCommit]] 5;</code>
_cam camCommit 5;
</sqf>


|seealso= [[direction]] [[setDir]] [[camSetTarget]]
|seealso= [[direction]] [[setDir]] [[camSetTarget]] [[getCameraViewDirection]]
}}
}}


<dl class="command_description">
{{Note
 
|user= Killzone_Kid
<dt></dt>
|timestamp= 20160509194700
<dd class="notedate">Posted on May 9, 2016 - 19:47 (UTC)</dd>
|text= [[cameraEffect]] "INTERNAL" works better than "EXTERNAL" with this command.
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
}}
<dd class="note">
[[cameraEffect]] "INTERNAL" works better than "EXTERNAL" with this command.
</dd>
 
</dl>

Latest revision as of 05:23, 2 January 2026

Hover & click on the images for description

Description

Description:
Sets the orientation of the given camera in the direction of the given vector. Needs camCommit. Since Arma 3 logo black.png 0.50, only the second syntax with a Vector3D is available.
Groups:
Camera Control

Syntax

Syntax:
camera camSetDir azimuth
Parameters:
camera: Object - object of type "camera"
azimuth: Number - camera azimuth
Return Value:
Nothing

Alternative Syntax

Syntax:
camera camSetDir direction
Parameters:
camera: Object - object of type "camera"
direction: Vector3D - direction of camera. Must be a valid vector.
Return Value:
Nothing

Examples

Example 1:
Since Arma 3:
private _pos1 = player modelToWorld [0, 5, 5]; private _pos2 = player modelToWorld [0, 50, 50]; private _cam = "camera" camCreate _pos1; _cam cameraEffect ["INTERNAL", "BACK"]; _cam camSetPos _pos2; _cam camSetDir (_pos2 vectorFromTo _pos1); _cam camCommit 5; waitUntil { camCommitted _cam }; _cam camSetPos _pos1; _cam camCommit 5;
Example 2:
Before Arma 3:
private _pos1 = player modelToWorld [0, 5, 5]; private _pos2 = player modelToWorld [0, 50, 50]; private _cam = "camera" camCreate _pos1; _cam cameraEffect ["INTERNAL", "BACK"]; _cam camSetPos _pos2; _cam camSetDir 180; _cam camCommit 5; waitUntil { camCommitted _cam }; _cam camSetPos _pos1; _cam camCommit 5;

Additional Information

See also:
direction setDir camSetTarget getCameraViewDirection

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord.
Only post proven facts here! Add Note
Killzone_Kid - c
Posted on May 09, 2016 - 19:47 (UTC)
cameraEffect "INTERNAL" works better than "EXTERNAL" with this command.