-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rotate scripted optic according to weapon bank (#1162)
* rotate scripted optic according to weapon bank * handle launchers, pistols * update variable names
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "script_component.hpp" | ||
/* ---------------------------------------------------------------------------- | ||
Internal Function: cba_optics_fnc_gunBank | ||
Description: | ||
Reports the bank at which the primary weapon is tilted. | ||
Parameters: | ||
None. | ||
Returns: | ||
Leaning angle of avatar. | ||
Examples: | ||
(begin example) | ||
call cba_optics_fnc_gunBank; | ||
(end) | ||
Author: | ||
commy2 | ||
---------------------------------------------------------------------------- */ | ||
|
||
private _unit = [] call CBA_fnc_currentUnit; | ||
|
||
private _pelvis = _unit modelToWorldVisualWorld (_unit selectionPosition "Pelvis"); | ||
private _camera = _unit modelToWorldVisualWorld (_unit selectionPosition "camera"); | ||
private _bodyUp = _pelvis vectorFromTo _camera; | ||
|
||
private _weaponDir = _unit weaponDirection currentWeapon _unit; | ||
private _weaponLat = vectorNormalized (_weaponDir vectorCrossProduct _bodyUp); | ||
private _weaponUp = _weaponLat vectorCrossProduct _weaponDir; | ||
|
||
private _screenRight = AGLToASL positionCameraToWorld [0,0,0] vectorFromTo AGLToASL positionCameraToWorld [1,0,0]; | ||
|
||
90 - acos (_screenRight vectorCos _weaponUp) // return |