Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed LIS checks in fast moving vehicles behaving unexpectedly #195

Merged
merged 3 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions addons/nametags/functions/fnc_calculateFadeValue.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
params ["_target", "_player"];
private _vehicle = vehicle _target;
private _distance = _player distance _vehicle;
private _pos = _vehicle modelToWorld [0,0,1.4];

private _darknessPenalty = 0;
private _rangeModifier = 0;
Expand Down Expand Up @@ -38,7 +37,10 @@ if (GVAR(enableFOVBoost)) then {

private _fadeValue = (linearConversion [0, (_maxDistance * _rangeModifier), _distance, 1, 0, true]) - _darknessPenalty;
if (GVAR(enableOcclusion)) then {
_fadeValue = _fadeValue - ([objNull, "FIRE"] checkVisibility [eyePos _player, _pos]);
_fadeValue = _fadeValue - ([objNull, "FIRE"] checkVisibility [
_player modelToWorldVisualWorld (_player selectionPosition "pilot"),
_vehicle modelToWorldVisual [0,0,1.4]
]);
};

// this function allows Mission Builders to implement there own coefs
Expand Down
9 changes: 7 additions & 2 deletions addons/nametags/functions/fnc_onDraw.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ if (GVAR(useLIS)) then {
// unit, per the comment from Pierre MGI at https://community.bistudio.com/wiki/cursorObject
// we'd like to find the cursorObject regardless, so we piggyback on the LIS check to find the most probable one

// This is the best we can do without a positionCameraToWorldVisual command.
// positionCameraToWorld translates position from camera space to world space in SIMULATION time scope,
// while a theoretical positionCameraToWorldVisual command would translate positions from camera space to world
// space in RENDER time scope.
private _camPos = _player modelToWorldVisualWorld (_player selectionPosition "pilot");
private _lis = lineIntersectsSurfaces [
AGLToASL positionCameraToWorld [0, 0, 0],
AGLToASL positionCameraToWorld [0, 0, GVAR(renderDistance) + 1],
_camPos,
_camPos vectorAdd ((getCameraViewDirection _player) vectorMultiply (GVAR(renderDistance) + 1)),
_player,
objNull,
true,
Expand Down