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

Conversation

derbismarck
Copy link
Contributor

Closes #194

Copy link
Owner

@diwako diwako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested it. The flickering in fast moving vehicles is still happening. However it is less as it looks like the detection is more accurate to the visual simulation.

Still there is one change request, detailed above.

@derbismarck
Copy link
Contributor Author

derbismarck commented May 27, 2021

Acknowledged -- I was also seeing that flickering but thought it was specific to another change we'd made, it might have to do with the distance check being performed, I'll take a look in the near future and make the requested change.

@diwako diwako added this to the Ongoing milestone May 29, 2021
…al time scope, moved `_pos` directly into `checkVisibility` statement as it's not needed in the function otherwise
@derbismarck
Copy link
Contributor Author

Confirmed that in diwako_dui_nametags_fnc_calculateFadeValue, the value of _distance is not at fault, presumably because despite the distance command not being in visual time scope, the actual offset in position for both the player and the vehicle being checked against is identical. Observe output of the following to see that the error between an exact visual distance check and a object1 distance object2 check is less than a centimeter, assuming that both object1 and object2 are in the same vehicle, or if one is the parent vehicle of the other.

onEachFrame {systemchat str abs (vectorMagnitude ((getPosASLVisual object1) vectorDiff (getPosASLVisual object2)) - (object1 distance object2))};

For the case of a player looking at a crewmember of their vehicle, object1 would usually be player and object2 would be vehicle player, at least as it's currently written (more on that down below).

So that wasn't the issue. However, the issue is in diwako_dui_nametags_fnc_calculateFadeValue -- it's with the visibility check. I've committed a fix for that that now utilizes visual commands to get eyepos, similarly to the change made in the LIS code. That fixes the flickering for me. I also made a small performance change by removing the definition of _pos and instead putting it directly in the checkVisibility call. Here's it fixed: https://giant.gfycat.com/BleakActualKagu.mp4

All of that being said, there are still some issues with how diwako_dui_nametags_fnc_calculateFadeValue works, which I've already looked at fixing. I'll likely create a separate PR/issue for those. They're mostly to do with the fact that _distance is being taken as the distance between _player and vehicle _target even when _player and _target are both crew in the same vehicle, leading to unexpectedly high fade values if both the _player and the _target are in a large vehicle, far from the center of the vehicle, but very close to one another.

Copy link
Owner

@diwako diwako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally gotten around and tested this. It does work as detailed in the post above. Also did some smallish performance testing and it was negligible as well

@diwako diwako requested a review from jokoho48 June 3, 2021 11:22
@diwako diwako modified the milestones: Ongoing, 1.9.2 Jun 3, 2021
@diwako diwako added the enhancement New feature or request label Jun 3, 2021
@diwako diwako merged commit a2c06c5 into diwako:master Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants