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

NetworkTransform's interpolator uses what looks like a configurable double lerp, with no way to configure it. #3112

Open
roydor opened this issue Oct 26, 2024 · 1 comment
Assignees
Labels
priority:high stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report

Comments

@roydor
Copy link

roydor commented Oct 26, 2024

Description

When using the NetworkTransform's interpolate method and a default TickRate of 30, interpolated objects often feel very floaty near places of sharp velocity changes especially in jumping. When interpolation is off, the positions are perfect, but obviously the appearance is very jittery since they are only updated once per network Tick.

The problem is this line of code:
https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/ngo/2.0.0/com.unity.netcode.gameobjects/Runtime/Components/Interpolator/BufferedLinearInterpolator.cs?fbclid=IwZXh0bgNhZW0CMTEAAR3FptsALIU67nKy8jIypEUz-_vmczp3IqjiKbxfamMQc1ZB4euxKrt3Wqk_aem_krAd3QtlotTmGgwAH7PxXg#L239

The second lerp attempts to lerp the current position to the target point (which is correctly lerping between positions). This makes the actual transform essentially ease-out as it approaches it's target, but never really reach it. Especially since the speed of this second lerp is attempting to travel the distance with a function of delta time rather than a function which spans 0-1.
If the variable names are correct, it would attempt to close the gap in a maximum of 0.1s, however that is much slower than the tick rate, and each time the target moves, the gap increases, keeping it constantly lagging behind.

Removing this line, or adjusting the speed of the second lerp provides the desired effect.

This floatiness and asymptotic nature of the second lerp causes issues with animations, being grounded, and the overall shape of how that network objects travels with respect to how the actual object moved.

Actual Outcome

The interpolators are marked private, and I am unable to tweak this public parameter

Expected Outcome

There is another other method on this interpolator to control the interpolation, and I would expect to be able to configure this part of that interpolator as well.

I would expect either that the interpolators are protected so that any class extending network transform can adjust these parameters, or a public method much like SetMaxInterpolationBound for me to set MaximumInterpolationTime

Screenshots

Unavailable.

Environment

Not relevant.

Additional Context

@roydor roydor added stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Oct 26, 2024
@roydor
Copy link
Author

roydor commented Oct 26, 2024

I took some screen recordings to showcase my problem.

Without the fix (default behaviour, showcasing the floatiness)
https://www.youtube.com/watch?v=U9YFbZa10TY

With a fix in place (increasing the second lerp speed)
https://youtu.be/9fHcQwkcOlg

@NoelStephensUnity NoelStephensUnity added the Investigating Issue is currently being investigated label Oct 28, 2024
@NoelStephensUnity NoelStephensUnity self-assigned this Oct 28, 2024
@NoelStephensUnity NoelStephensUnity added priority:high stat:import Status - Issue is going to be saved internally labels Oct 28, 2024
@michalChrobot michalChrobot added priority:high stat:imported Status - Issue is tracked internally at Unity and removed priority:high stat:import Status - Issue is going to be saved internally Investigating Issue is currently being investigated stat:awaiting triage Status - Awaiting triage from the Netcode team. labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:high stat:imported Status - Issue is tracked internally at Unity type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

3 participants