eyeDirection: Difference between revisions
Jump to navigation
Jump to search
Waffle SS. (talk | contribs) m (global args) |
Killzone Kid (talk | contribs) (example) |
||
Line 26: | Line 26: | ||
} | } | ||
</code>|= EXAMPLE1 | </code>|= EXAMPLE1 | ||
|x2= Draw AI eye direction (green) and weapon direction (red) in 3D: <code>bob = [[createGroup]] [[east]] [[createUnit]] ["O_Soldier_F", [0,0,0], [], 0, "NONE"]; | |||
bob [[setVehiclePosition]] <nowiki>[</nowiki>[[player]] [[modelToWorld]] [0,100,0], [], 0, "NONE"]; | |||
[[onEachFrame]] | |||
{ | |||
_beg = [[eyePos]] bob; | |||
_endE = (_beg [[vectorAdd]] ([[eyeDirection]] bob [[vectorMultiply]] 100)); | |||
[[drawLine3D]] <nowiki>[</nowiki>[[ASLToAGL]] _beg, [[ASLToAGL]] _endE, [0,1,0,1]]; | |||
_endW = (_beg [[vectorAdd]] (bob [[weaponDirection]] [[currentWeapon]] bob [[vectorMultiply]] 100)); | |||
drawLine3D <nowiki>[</nowiki>[[ASLToAGL]] _beg, [[ASLToAGL]] _endW, [1,0,0,1]]; | |||
};</code> |= Example 2 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ |
Revision as of 15:45, 11 February 2016
Description
- Description:
- Returns the direction object is watching (eyes, or a vehicle primary observer).
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
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) ] }
- 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 = eyePos bob; _endE = (_beg vectorAdd (eyeDirection bob vectorMultiply 100)); drawLine3D [ASLToAGL _beg, ASLToAGL _endE, [0,1,0,1]]; _endW = (_beg vectorAdd (bob weaponDirection currentWeapon bob vectorMultiply 100)); drawLine3D [ASLToAGL _beg, ASLToAGL _endW, [1,0,0,1]]; };
Additional Information
- See also:
- positionCameraToWorldweaponDirection
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
Notes
Bottom Section
- Posted on May 26, 2014 - 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. In fact the direction returned by eyeDirection is avatar's head direction relative to the torso (minus ambient head animation factor). Play with the script in example 1 to find out limitations. If you need centre of screen direction, use positionCameraToWorld instead.