switchCamera: Difference between revisions

From Bohemia Interactive Community
(alt syntax)
m (Some wiki formatting)
 
(58 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


| Switch camera to given vehicle / camera. Mode is one of:  
|game3= arma1
|version3= 1.00
 
|game4= arma2
|version4= 1.00
 
|game5= arma2oa
|version5= 1.50
 
|game6= tkoh
|version6= 1.00
 
|game7= arma3
|version7= 0.50
 
|gr1= Camera Control
 
|descr= Switch camera to given vehicle / camera. Mode is one of:
* '''"INTERNAL"''': 1st person
* '''"INTERNAL"''': 1st person
* '''"GUNNER"''': optics / sights
* '''"GUNNER"''': optics / sights
* '''"EXTERNAL"''': 3rd person
* '''"EXTERNAL"''': 3rd person (inaccessible if difficulty settings do not allow for it)
* '''"GROUP"''': group
* '''"GROUP"''': group
* '''"CARGO"''': same as "INTERNAL"
* '''"CARGO"''': same as "INTERNAL"


If you switch to a unit in a vehicle, this command uses the correct turret. Control over the unit is not given to the player. Use [[selectPlayer]] or a combination of [[switchCamera]] and [[remoteControl]] to achieve this.
If you switch to a unit in a vehicle, this command uses the correct turret.
|= Description
{{Feature|important|
____________________________________________________________________________________________
* Control over the unit is not given to the player. Use [[selectPlayer]] or a combination of [[switchCamera]] and [[remoteControl]] to achieve this.
* Always [[switchCamera]] first (when needed) '''before''' using [[remoteControl]] as doing it after may lead to unpredictable results.
}}
 
|s1= target [[switchCamera]] mode


| target '''switchCamera''' mode |= Syntax
|p1= target: [[Object]]


|p1= target: [[Object]] |= Parameter 1
|p2= mode: [[String]]


|p2= mode: [[String]] |= Parameter 2
|r1= [[Nothing]]


| [[Nothing]] |= Return value
|s2= [[switchCamera]] target


| s2 = '''switchCamera''' target        ''since Arma 3 v1.65.138884 |= Syntax
|s2since= arma3 1.66


|p21= target: [[Object]] |= Parameter 1
|p21= target: [[Object]]


r2=[[Nothing]] |= Return value
|r2= [[Nothing]]
____________________________________________________________________________________________
 
|x1= <code>[[player]] [[switchCamera]] "Gunner";</code> |= Example 1
|x2= <code>[[vehicle]] [[player]] [[switchCamera]] "External";</code> |= Example 2
____________________________________________________________________________________________


| [[cameraView]], [[cameraOn]], [[cameraEffect]], [[selectPlayer]], [[remoteControl]] |= See also
|x1= <sqf>player switchCamera "Gunner";</sqf>


|x2= <sqf>vehicle player switchCamera "External";</sqf>
|seealso= [[cameraView]] [[cameraOn]] [[cameraEffect]] [[selectPlayer]] [[remoteControl]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
|user= Killzone_Kid
|timestamp= 20150516131400
|text=  Force top down view:
<sqf>
private _cameraObject = "Land_HandyCam_F" createVehicleLocal [0, 0, 0];
_cameraObject hideObject true;
_cameraObject attachTo [player, [0, 0, 10]];
_cameraObject setVectorUp [0, 0.99, 0.01];
_cameraObject switchCamera "Internal";
 
findDisplay 46 displayAddEventHandler ["MouseButtonDown", {
if (_this select 1 == 0) then
{
player forceWeaponFire [currentMuzzle player, currentWeaponMode player];
};


<h3 style="display:none">Bottom Section</h3>
false;
[[Category:Scripting Commands|SWITCHCAMERA]]
}];
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|SWITCHCAMERA]]
[[Category:Scripting Commands OFP 1.46|SWITCHCAMERA]]
[[Category:Scripting Commands ArmA|SWITCHCAMERA]]
[[Category:Command_Group:_Camera_Control|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
findDisplay 46 displayAddEventHandler ["KeyDown", {
<dl class="command_description">
if (_this select 1 in actionKeys "ReloadMagazine") then
<dd class="notedate">Posted on May 16, 2015 - 13:14 (UTC)</dd>
{
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
reload player;
<dd class="note">
Force top down view: <code>cam <nowiki>=</nowiki> "Land_HandyCam_F" [[createVehicleLocal]] [0,0,0];
cam [[hideObject]] [[true]];
cam [[attachTo]] <nowiki>[</nowiki>[[player]], [0,0,10]];
cam [[setVectorUp]] [0,0.99,0.01];
cam [[switchCamera]] "Internal";
[[findDisplay]] 46 [[displayAddEventHandler]] ["MouseButtonDown", {
[[if]] (_this [[select]] 1 <nowiki>==</nowiki> 0) [[then]] {
[[player]] [[forceWeaponFire]] <nowiki>[</nowiki>[[currentMuzzle]] [[player]], [[currentWeaponMode]] [[player]]];
};
};
[[false]]
 
false;
}];
}];
[[findDisplay]] 46 [[displayAddEventHandler]] ["KeyDown", {
</sqf>
[[if]] (_this [[select]] 1 [[in]] [[actionKeys]] "ReloadMagazine") [[then]] {
}}
[[reload]] [[player]];
};
[[false]]
}];</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 13:56, 27 October 2025

Hover & click on the images for description

Description

Description:
Switch camera to given vehicle / camera. Mode is one of:
  • "INTERNAL": 1st person
  • "GUNNER": optics / sights
  • "EXTERNAL": 3rd person (inaccessible if difficulty settings do not allow for it)
  • "GROUP": group
  • "CARGO": same as "INTERNAL"
If you switch to a unit in a vehicle, this command uses the correct turret.
Groups:
Camera Control

Syntax

Syntax:
target switchCamera mode
Parameters:
target: Object
mode: String
Return Value:
Nothing

Alternative Syntax

Syntax:
switchCamera target
Parameters:
target: Object
Return Value:
Nothing

Examples

Example 1:
player switchCamera "Gunner";
Example 2:
vehicle player switchCamera "External";

Additional Information

See also:
cameraView cameraOn cameraEffect selectPlayer remoteControl

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 16, 2015 - 13:14 (UTC)
Force top down view:
private _cameraObject = "Land_HandyCam_F" createVehicleLocal [0, 0, 0]; _cameraObject hideObject true; _cameraObject attachTo [player, [0, 0, 10]]; _cameraObject setVectorUp [0, 0.99, 0.01]; _cameraObject switchCamera "Internal"; findDisplay 46 displayAddEventHandler ["MouseButtonDown", { if (_this select 1 == 0) then { player forceWeaponFire [currentMuzzle player, currentWeaponMode player]; }; false; }]; findDisplay 46 displayAddEventHandler ["KeyDown", { if (_this select 1 in actionKeys "ReloadMagazine") then { reload player; }; false; }];