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

Update DistanceCondition.cs #576

Merged
merged 1 commit into from
Dec 28, 2023
Merged

Conversation

CRG-Robban
Copy link
Contributor

DistanceCondition flickering fix. Hide distance calculation was incorrect.

DistanceCondition flickering fix.
@FirstGearGames
Copy link
Owner

FirstGearGames commented Dec 28, 2023

Thank you for this find. Your fix does work but I do not believe the calculated result is the intended result.
EG: if distance is 3f and multiplier is 0.1 then yours would be 9.9 (3 * 3 * (1.1)).
If I'm not mistaken, which I could be so correct me if I'm wrong, it should be (3 * 1.1) sq2.
result: 3 * 1.1 = 3.3. Hide = 3.3 * 3.3 > 10.89

Code:

            float maxDistanceHide = _maximumDistance * (1f + _hideDistancePercent);
            _sqrHideMaximumDistance = (maxDistanceHide * maxDistanceHide);

@FirstGearGames
Copy link
Owner

Going to accept the PR for find credit. ty again.

@FirstGearGames FirstGearGames merged commit 2349a29 into FirstGearGames:main Dec 28, 2023
FirstGearGames pushed a commit that referenced this pull request Jan 12, 2024
- Added TransportManager.Get/SetMTUReserve(int) to allow reserving bytes in buffers, such as use with IntermediateLayer to insert encryption data. Reserving bytes does not consume more bandwidth if bytes are not filled.
- Improved TransportManager.GetMTU methods to consider reserve.
- Improved exposed TimeManager.PingInterval.
- Fixed Fish-Networking menu item order.
- Improved created replicates which arrive after the run tick are now run in replays instead of twice.
- Changed ReplicateState.UserCreated renamed to CurrentCreated for clarity.
- Changed ReplicateState.Predicted renamed to CurrentPredicted for clarity.
- Changed ReplicateState.ReplayedPredicted/UserCreated renamed to Replayed.
- Added ReplicateState.Future to indicate future prediction of objects.
- Changed SceneLoad/UnloadData PreferredScene is now a structure.
- Added SceneLoad/UnloadData PreferredScene can now specify different scenes for client and server.
- Fixed Prediction v2 reconcile desyncs for NonAuthoritative.
- Fixed Prediction v2 reconcile desyncs for Authoritative.
- Improved RigidbodyPauser to be simplified and more flexible for edge-case setups.
- Fixed Prediction v2 garbage allocation from physics.
- Fixed Prediction v2 excessive replays of remote objects when local client was not moving.
- Removed NetworkManager.StaticLogXYZ methods.
- Added NetworkManagerExtensions.Log/Warnig/Error.
- Added Log/Warning/Error extensions for NetworkManager references; null references may be used.
- Improved NetworkManager logging methods now use Unity debug when NetworkManager does not exist in any scene.
- Improved ServerManager.ShareIds made public.
- Improved BufferLast always uses reliable channel for new observers now.
- Fixed a SyncType not being set dirty by server within OnStartServer due to no observers count, resulting in predicted spawners not getting the new value update.
- Added Prediction v2 teleport option for graphical object.
- Improved List.AddUnique now returns if added, as well value no longer boxes. (#579)(#580)
- Fixed preferred scene not being applied to global scenes for late joiners (#585)
- Fixed inversed transform offsets in GetTransformOffsets and SetTransformOffsets. (#578)
- Fixed DistanceCondition causing flickering due to incorrect hide distance calculation. (#576)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants