From 10ac268e9fb3a56632b4900c064cbf750ad27bdd Mon Sep 17 00:00:00 2001 From: TastSong Date: Mon, 15 Apr 2024 16:46:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BD=91=E7=BB=9C=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=20=E5=B9=B3=E6=BB=91=E5=B0=8F=E8=BD=A6=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CrazyCarClient/Assets/Scripts/Game/MPlayer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CrazyCarClient/Assets/Scripts/Game/MPlayer.cs b/CrazyCarClient/Assets/Scripts/Game/MPlayer.cs index 1bd7e080f..a1ceecb0e 100644 --- a/CrazyCarClient/Assets/Scripts/Game/MPlayer.cs +++ b/CrazyCarClient/Assets/Scripts/Game/MPlayer.cs @@ -55,7 +55,8 @@ public class MPlayer : MonoBehaviour, IController { // 消除移动时的顿挫感 private Coroutine moveNetCarCor = null; - private float smoothSpeed = 1; + private float smoothSpeed = 4f; + private Vector3 currentVelocity = Vector3.zero; private void Start() { pathCreator = this.GetModel().PathCreator; @@ -138,6 +139,7 @@ private IEnumerator MoveNetCar(Vector3 pos, Vector3 speed) { yield return new WaitForSecondsRealtime(Time.deltaTime); transform.position = Vector3.Lerp(transform.position, pos, Time.deltaTime * smoothSpeed); rig.velocity = Vector3.Lerp(rig.velocity, speed, Time.deltaTime * smoothSpeed); + rig.velocity = Vector3.SmoothDamp(rig.velocity, speed, ref currentVelocity, Time.deltaTime * smoothSpeed); time -= Time.deltaTime; } }