getCameraViewDirection: Difference between revisions
Jump to navigation
Jump to search
m (Replaced <code> with <sqf>) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 7: | Line 7: | ||
|gr1= Object Manipulation | |gr1= Object Manipulation | ||
|descr= Returns the direction unit is looking in render time scope. While for AI the origin for the view direction vector can be taken from | |descr= Returns the direction unit is looking in render time scope. While for AI the origin for the view direction vector can be taken from <sqf inline>eyePos unit</sqf>, for human player the origin should be taken from player camera position <sqf inline>positionCameraToWorld [0,0,0]</sqf> | ||
|s1= [[getCameraViewDirection]] unit | |s1= [[getCameraViewDirection]] unit | ||
Line 16: | Line 16: | ||
|x1= Draw AI eye direction (green), weapon direction (red) and camera direction (blue) in 3D: | |x1= Draw AI eye direction (green), weapon direction (red) and camera direction (blue) in 3D: | ||
<sqf>Bob = createGroup east createUnit ["O_Soldier_F", [0,0,0], [], 0, "NONE"]; | <sqf> | ||
Bob = createGroup east createUnit ["O_Soldier_F", [0,0,0], [], 0, "NONE"]; | |||
Bob setVehiclePosition [player modelToWorld [0,100,0], [], 0, "NONE"]; | Bob setVehiclePosition [player modelToWorld [0,100,0], [], 0, "NONE"]; | ||
onEachFrame { | onEachFrame { | ||
Line 26: | Line 27: | ||
_endV = (_beg vectorAdd (getCameraViewDirection Bob vectorMultiply 100)); | _endV = (_beg vectorAdd (getCameraViewDirection Bob vectorMultiply 100)); | ||
drawLine3D [_beg, _endV, [0,0,1,1]]; | drawLine3D [_beg, _endV, [0,0,1,1]]; | ||
};</sqf> | }; | ||
</sqf> | |||
|seealso= [[positionCameraToWorld]] [[weaponDirection]] [[eyeDirection]] [[vectorDir]] [[vectorDirVisual]] | |seealso= [[positionCameraToWorld]] [[weaponDirection]] [[eyeDirection]] [[vectorDir]] [[vectorDirVisual]] | ||
}} | }} |
Revision as of 16:48, 27 July 2023
Description
- Description:
- Returns the direction unit is looking in render time scope. While for AI the origin for the view direction vector can be taken from eyePos unit, for human player the origin should be taken from player camera position positionCameraToWorld [0,0,0]
- Groups:
- Object Manipulation
Syntax
- Syntax:
- getCameraViewDirection unit
- Parameters:
- unit: Object
- Return Value:
- Array - 3D Vector
Examples
- Example 1:
- Draw AI eye direction (green), weapon direction (red) and camera direction (blue) 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]]; _endV = (_beg vectorAdd (getCameraViewDirection Bob vectorMultiply 100)); drawLine3D [_beg, _endV, [0,0,1,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