camSetDir: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Add seeAlso link)
 
(63 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.00


|1.00|= Game version
|game2= ofpe
|version2= 1.00


|arg= local |= Arguments in MP
|game3= arma1
|version3= 1.00


|eff= local |= Effects in MP
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| Set the direction of the given camera in the direction of the given vector. Needs the call of [[camCommit]] to be conducted. |= Description
|game5= arma2oa
____________________________________________________________________________________________
|version5= 1.50


| camera '''camSetDir''' direction |= Syntax
|game6= tkoh
|version6= 1.00


|p1= camera: [[Object]] - object of type "camera" |= Parameter 1
|game7= arma3
|version7= 0.50


|p2= direction: [[Array]] in format [x,y,z] - direction of camera. Must be a valid vector. |= Parameter 2
|gr1= Camera Control


| [[Nothing]] |= Return value
|arg= local
____________________________________________________________________________________________
 
|x1= <code>pos1 = [[player]] [[modelToWorld]] [0,5,5];
cam = "camera" [[camCreate]] pos1;
cam [[cameraEffect]] ["EXTERNAL", "BACK"];
pos2 = [[player]] [[modelToWorld]] [0,50,50];
cam [[camSetPos]] pos2;
cam [[camSetDir]] (pos2 [[vectorFromTo]] pos1);
cam [[camCommit]] 5;
0 = [] [[spawn]]
{
[[waitUntil]] {[[camCommitted]] cam};
cam [[camSetPos]] pos1;
cam [[camCommit]] 5;
};</code> |= Example 1
____________________________________________________________________________________________


| [[direction]], [[setDir]], [[camSetTarget]] |= See also
|eff= local


}}
|descr= Sets the orientation of the given camera in the direction of the given vector. Needs [[camCommit]].
 
|s1= camera [[camSetDir]] direction
 
|p1= camera: [[Object]] - object of type "camera"
 
|p2= direction:
* [[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]]
 
|x1= Since {{arma3}}:
<sqf>
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;
</sqf>
 
|x2= Before {{arma3}}:
<sqf>
private _pos1 = player modelToWorld [0, 5, 5];
private _pos2 = player modelToWorld [0, 50, 50];


<h3 style="display:none">Notes</h3>
private _cam = "camera" camCreate _pos1;
<dl class="command_description">
_cam cameraEffect ["INTERNAL", "BACK"];


</dl>
_cam camSetPos _pos2;
_cam camSetDir 180;
_cam camCommit 5;
waitUntil { camCommitted _cam };


<h3 style="display:none">Bottom Section</h3>
_cam camSetPos _pos1;
_cam camCommit 5;
</sqf>


[[Category:Scripting Commands|CAMSETDIR]]
|seealso= [[direction]] [[setDir]] [[camSetTarget]] [[getCameraViewDirection]]
[[Category:Scripting Commands OFP 1.99|CAMSETDIR]]
}}
[[Category:Scripting Commands OFP 1.96|CAMSETDIR]]
[[Category:Scripting Commands OFP 1.46|CAMSETDIR]]
[[Category:Scripting Commands ArmA|CAMSETDIR]]
[[Category:Command Group: Camera Control|CAMSETDIR]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Killzone_Kid
<dd class="notedate">Posted on May 9, 2016 - 19:47 (UTC)</dd>
|timestamp= 20160509194700
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|text= [[cameraEffect]] "INTERNAL" works better than "EXTERNAL" with this command.
<dd class="note">
}}
For reliab;e operation of the command, the vector of direction passed to the command must be a valid vector. Also values [0,0,1] and [0,0,-1] cause camera to reset after animation committed. To workaround this you can use [0,0.001,0.999] or [0,0.001,-0.999] instead. Reset also doesn't happen if x or y <nowiki>!=</nowiki> 0, for example [1,0,1] or [0,1,-1].
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 01:23, 21 May 2023

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.
Groups:
Camera Control

Syntax

Syntax:
camera camSetDir direction
Parameters:
camera: Object - object of type "camera"
direction:
  • Number (before Arma 3 logo black.png0.50) - camera azimuth
  • Array in format [x,y,z] (since Arma 3 logo black.png0.50) - 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 or on the Forums.
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.