mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Intersection Check / FOV adjustment
This commit is contained in:
parent
4570f77249
commit
b02086ca52
@ -68,13 +68,17 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model;
|
||||
|
||||
[{
|
||||
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL"];
|
||||
|
||||
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
|
||||
|
||||
PARAMS_2(_args,_pfID);
|
||||
EXPLODE_6_PVT(_args,_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_actionID);
|
||||
|
||||
_virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
|
||||
_virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition);
|
||||
_lineInterection = lineIntersects [eyePos ACE_player, _virtualPosASL, ACE_player];
|
||||
|
||||
//Don't allow placing in a bad position:
|
||||
if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};
|
||||
|
||||
if ((GVAR(placeAction) != PLACE_WAITING) ||
|
||||
{_unit != ACE_player} ||
|
||||
@ -94,7 +98,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
};
|
||||
} else {
|
||||
//Show the virtual object:
|
||||
if (lineIntersects [eyePos ACE_player, _virtualPosASL, ACE_player]) then {
|
||||
if (_lineInterection) then {
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
|
||||
} else {
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true;
|
||||
@ -102,7 +106,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
||||
if (_screenPos isEqualTo []) exitWith {
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
|
||||
};
|
||||
_realDistance = _virtualPos distance (positionCameraToWorld [0,0,0]);
|
||||
_realDistance = (_virtualPos distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1);
|
||||
_screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)];
|
||||
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos;
|
||||
_dir = (positionCameraToWorld [0,0,1]) vectorFromTo (positionCameraToWorld [0,0,0]);
|
||||
|
Loading…
Reference in New Issue
Block a user