eyeDirection: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (removed misleading sentence) |
Lou Montana (talk | contribs) m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>") |
||
(88 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| arma3 |= | |game1= arma3 | ||
|version1= 0.50 | |||
|arg= global | |arg= global | ||
| | |gr1= Object Manipulation | ||
| | |descr= Returns the direction object is watching (eyes, or a vehicle primary observer). | ||
| | |s1= [[eyeDirection]] unit | ||
| [[ | |p1= unit: [[Object]] | ||
|r1= [[Array]] - 3D Vector | |||
|x1= < | |x1= <sqf> | ||
Can = "Land_Can_V3_F" createVehicle position player; | |||
onEachFrame { | |||
Can setPosASL [ | |||
(eyePos player select 0) + (eyeDirection player select 0), | |||
(eyePos player select 1) + (eyeDirection player select 1), | |||
(eyePos player select 2) + (eyeDirection player select 2) | |||
} | ] | ||
</ | }; | ||
</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 = createGroup east createUnit ["O_Soldier_F", [0,0,0], [], 0, "NONE"]; | |||
{ | Bob setVehiclePosition [player modelToWorld [0,100,0], [], 0, "NONE"]; | ||
_beg = | onEachFrame { | ||
_endE = (_beg | _beg = ASLToAGL eyePos Bob; | ||
_endE = (_beg vectorAdd (eyeDirection Bob vectorMultiply 100)); | |||
_endW = (_beg | drawLine3D [_beg, _endE, [0,1,0,1]]; | ||
_endW = (_beg vectorAdd (Bob weaponDirection currentWeapon Bob vectorMultiply 100)); | |||
};</ | drawLine3D [_beg, _endW, [1,0,0,1]]; | ||
}; | |||
</sqf> | |||
| [[positionCameraToWorld]] | |seealso= [[positionCameraToWorld]] [[weaponDirection]] [[getCameraViewDirection]] [[vectorDir]] [[vectorDirVisual]] | ||
}} | }} | ||
<dl class="command_description"> | |||
<dl class= | |||
< | <dt></dt> | ||
<dd class="notedate">Posted on 2014-05-26 - 19:10 (UTC)</dd> | |||
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt> | |||
<dd class="notedate">Posted on | |||
<dt class="note"> | |||
<dd class="note"> | <dd class="note"> | ||
This command should have really been named ''headDirection'' instead of [[eyeDirection]] as one could mistakenly think that eyes direction of your avatar correspond to the direction of the centre of your screen. Play with the script in example 1 to find out limitations. If you need centre of screen direction, use [[positionCameraToWorld]] instead. | This command should have really been named ''headDirection'' instead of [[eyeDirection]] as one could mistakenly think that eyes direction of your avatar correspond to the direction of the centre of your screen. Play with the script in example 1 to find out limitations. If you need centre of screen direction, use [[positionCameraToWorld]] instead. | ||
</dd> | </dd> | ||
</dl> | </dl> | ||
Latest revision as of 12:34, 3 September 2024
Description
- Description:
- Returns the direction object is watching (eyes, or a vehicle primary observer).
- Groups:
- Object Manipulation
Syntax
- Syntax:
- eyeDirection unit
- Parameters:
- unit: Object
- Return Value:
- Array - 3D Vector
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 2014-05-26 - 19:10 (UTC)
- Killzone_Kid
- This command should have really been named headDirection instead of eyeDirection as one could mistakenly think that eyes direction of your avatar correspond to the direction of the centre of your screen. Play with the script in example 1 to find out limitations. If you need centre of screen direction, use positionCameraToWorld instead.