From 0e3af6694c005c16ab3fc88ce77169dbc75516a8 Mon Sep 17 00:00:00 2001 From: mischa Date: Wed, 3 Apr 2024 18:12:32 +0800 Subject: [PATCH] blend over rtt --- .../Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs b/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs index 94e91c3f7..598fe9d59 100644 --- a/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs +++ b/Assets/Mirror/Components/ForecastRigidbody/ForecastRigidbody.cs @@ -33,8 +33,9 @@ public class ForecastRigidbody : NetworkBehaviour Vector3 lastPosition; [Header("Blending")] - [Tooltip("Blend to remote state over this period of time, accelerating the blending exponentially.")] - public float blendingTime = 0.500f; + [Tooltip("Blend to remote state over a N * rtt time.\n For a 200ms ping, we blend over N * 200ms.\n For 20ms ping, we blend over N * 20 ms.")] + public float blendingRttMultiplier = 3; + public float blendingTime => (float)NetworkTime.rtt * blendingRttMultiplier; [Tooltip("Blending speed over time from 0 to 1. Exponential is recommended.")] public AnimationCurve blendingCurve = AnimationCurve.EaseInOut(0, 0, 1, 1); ForecastState state = ForecastState.FOLLOWING; // follow until the player interacts