This repository has been archived by the owner on Aug 15, 2022. It is now read-only.
Fix interpolation starting from incorrect source when disowned #391
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The interpolation target is used on clients in combination with the source to interpolate from the old value to the new. The owner, however, does not need it, as it is the authority on what the values are in the first place.
When ownership later changes to another object, the original owner will also start interpolating, as expected, and will also call
SnapInterpolations
to ensure all interpolation immediately resolves to its target.This is fine, but the owner never seems to keep track of the target interpolation in the first place, as it's only read by others. This causes the owner to snap to the values it had from before it became owner (or the default values if it was the first owner). After snapping, it would then start interpolating from the outdated value to the new target sent by the new owner, and "correct" itself from there on out.
In the case of e.g. a scale that is applied, this could result in a noticeable visual "glitch" where the owner would see the object shrink back to its initial value, then grow very quickly to the size it was, and then start interpolating. In other words:
Float3
ofVector3
scale using the transform as in a typical case, in the same way as the moving cube example, but for scale.(1, 1, 1)
.This fixes that by also keeping the target around on the owner, where it can then be used in that corner case.
Possibly fixes #220. Needs a manual regenerate or update of existing network objects to actually do anything.