Skip to content

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

Open
@roydor

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

priority:highThis issue has high priority and we are focusing to resolve itstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions