weaponDirection: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^ ]*)<\/code>" to "$1$2</code>") |
Lou Montana (talk | contribs) m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>") |
||
(29 intermediate revisions by the same user not shown) | |||
Line 26: | Line 26: | ||
|descr= Returns the direction that the vehicle weapon is aiming in. For addons the weapon name must be an entry in [[:Category:CfgWeapons|CfgWeapons]]. | |descr= Returns the direction that the vehicle weapon is aiming in. For addons the weapon name must be an entry in [[:Category:CfgWeapons|CfgWeapons]]. | ||
{{Feature | | {{Feature|informative|Turret and gun angle in degrees can also be obtained using [[animationSourcePhase]] or [[animationPhase]] commands.}} | ||
|s1= vehicleName [[weaponDirection]] weaponName | |s1= vehicleName [[weaponDirection]] weaponName | ||
Line 36: | Line 36: | ||
|r1= [[Array]] - format [[Vector3D]] | |r1= [[Array]] - format [[Vector3D]] | ||
|x1= < | |x1= <sqf>_weaponVectorDir = player weaponDirection currentWeapon player;</sqf> | ||
|x2= Draw AI eye direction (green) and weapon direction (red) in 3D: | |x2= Draw AI eye direction (green) and weapon direction (red) in 3D: | ||
< | <sqf> | ||
bob | bob = createGroup east createUnit ["O_Soldier_F", [0,0,0], [], 0, "NONE"]; | ||
bob setVehiclePosition [player modelToWorld [0,100,0], [], 0, "NONE"]; | |||
onEachFrame | |||
{ | { | ||
_beg = | _beg = ASLToAGL eyePos bob; | ||
_endE = _beg | _endE = _beg vectorAdd (eyeDirection bob vectorMultiply 100); | ||
drawLine3D [_beg, _endE, [0,1,0,1]]; | |||
_endW = _beg | _endW = _beg vectorAdd (bob weaponDirection currentWeapon bob vectorMultiply 100); | ||
drawLine3D [_beg, _endW, [1,0,0,1]]; | |||
};</ | }; | ||
</sqf> | |||
|seealso= [[positionCameraToWorld]] [[getCameraViewDirection]] [[eyeDirection]] [[vectorDir]] [[vectorDirVisual]] | |seealso= [[positionCameraToWorld]] [[getCameraViewDirection]] [[eyeDirection]] [[vectorDir]] [[vectorDirVisual]] | ||
Line 56: | Line 58: | ||
<dt></dt> | <dt></dt> | ||
<dd class="notedate">Posted on | <dd class="notedate">Posted on 2007-08-18 - 12:18</dd> | ||
<dt class="note">[[User:HAC_mainframe|HWM mainframe]]</dt> | <dt class="note">[[User:HAC_mainframe|HWM mainframe]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
Line 64: | Line 66: | ||
The return array can be processed-converted into degrees as follows: | The return array can be processed-converted into degrees as follows: | ||
< | <sqf> | ||
_dir_degrees = (_array select 0) atan2 (_array | _array = _this weaponDirection "weapon class"; | ||
_dir_degrees = (_array select 0) atan2 (_array select 1); | |||
</sqf> | |||
</dd> | </dd> | ||
<dt><dt> | <dt><dt> | ||
<dd class="notedate">Posted on | <dd class="notedate">Posted on 2007-11-11 - 01:41</dd> | ||
<dt class="note">[[User:Messiah2|MessiahUA]]</dt> | <dt class="note">[[User:Messiah2|MessiahUA]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
Line 76: | Line 80: | ||
<dt><dt> | <dt><dt> | ||
<dd class="notedate">Posted on | <dd class="notedate">Posted on 2007-11-13 - 15:54</dd> | ||
<dt class="note">[[User:UNN|UNN]]</dt> | <dt class="note">[[User:UNN|UNN]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
For an alternative to the weaponDirection command, see the following post on the official forums. On how to obtain the direction of multiple turrets on vehicles. | For an alternative to the weaponDirection command, see the following post on the official forums. On how to obtain the direction of multiple turrets on vehicles. | ||
{{ | {{Link|link= http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=a25eef63faad0e555557e7e17118a60c;act=ST;f=80;t=69777|text= Turret Animations}} - {{Link|link= http://forums.bistudio.com/showthread.php?t=63918|text= new forum}} | ||
</dd> | </dd> | ||
<dt><dt> | <dt><dt> | ||
<dd class="notedate">Posted on | <dd class="notedate">Posted on 2014-12-09 - 18:25 (UTC)</dd> | ||
<dt class="note">[[User:Mechariuswh|Mechariuswh]]</dt> | <dt class="note">[[User:Mechariuswh|Mechariuswh]]</dt> | ||
<dd class="note"> | <dd class="note"> |
Latest revision as of 11:34, 3 September 2024
Description
- Description:
- Returns the direction that the vehicle weapon is aiming in. For addons the weapon name must be an entry in CfgWeapons.
- Groups:
- WeaponsUnit Control
Syntax
- Syntax:
- vehicleName weaponDirection weaponName
- Parameters:
- vehicleName: Object
- weaponName: String
- Return Value:
- Array - format Vector3D
Examples
- Example 1:
- Example 2:
- Draw AI eye direction (green) and weapon direction (red) in 3D:
bob = createGroup east createUnit ["O_Soldier_F", [0,0,0], [], 0, "NONE"]; bob setVehiclePosition [player modelToWorld [0,100,0], [], 0, "NONE"]; onEachFrame { _beg = ASLToAGL eyePos bob; _endE = _beg vectorAdd (eyeDirection bob vectorMultiply 100); drawLine3D [_beg, _endE, [0,1,0,1]]; _endW = _beg vectorAdd (bob weaponDirection currentWeapon bob vectorMultiply 100); drawLine3D [_beg, _endW, [1,0,0,1]]; };
Additional Information
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
- Posted on 2007-08-18 - 12:18
- HWM mainframe
- Works great in multiplayer. The numbers are representing offset as follows : [X axis,Y axis,Z axis] The return array can be processed-converted into degrees as follows:
- Posted on 2007-11-11 - 01:41
- MessiahUA
- WeaponClass can only be the primary turret of the vehicle. For example it is not possible to get direction of commander's M2 on M1Abrams.
- Posted on 2007-11-13 - 15:54
- UNN
- For an alternative to the weaponDirection command, see the following post on the official forums. On how to obtain the direction of multiple turrets on vehicles. Turret Animations (dead link) - new forum
- Posted on 2014-12-09 - 18:25 (UTC)
- Mechariuswh
- The suggestion above using atan2 and weaponDirection get the direction the barrel of a weapon is pointing, but this is not the same as the direction a shell will be fired (verify this by getting in an M4 Scorcher, parking it on a slope, elevating the barrel "across" the slope and watching the shell come out in third person).
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Elite version 1.00
- Operation Flashpoint: Elite: New Scripting Commands
- Operation Flashpoint: Elite: Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Weapons
- Command Group: Unit Control