From f9750f779160c688bda77e9a240e9460c01938c7 Mon Sep 17 00:00:00 2001 From: Tungdv Date: Wed, 24 Dec 2025 16:53:14 +0700 Subject: [PATCH] fix: update logic move on ground. --- Assets/PerfectWorld/Scripts/Move/EC_CDR.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs b/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs index 529dc0c657..da7d148a43 100644 --- a/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs +++ b/Assets/PerfectWorld/Scripts/Move/EC_CDR.cs @@ -341,7 +341,7 @@ namespace BrewMonster { vStart += Vector3.up * CDRInfo.fStepHeight; posFoot = vStart - Vector3.up * vExt.y; - fDeltaDist = vVelocity.magnitude; + fDeltaDist = (vVelocity.normalized).magnitude; bool bMove = !Physics.Raycast(posFoot, (posFoot + vVelocity).normalized, out hit, fDeltaDist, mask); //Vector3 posDelta = vDelta; @@ -354,12 +354,14 @@ namespace BrewMonster } else { - Debug.DrawLine(vFinalPos, vFinalPos + vDelta, Color.red, 10f); + //Debug.DrawLine(vFinalPos, vFinalPos + vDelta, Color.red, 10f); vFinalPos += vDelta; } - if(fDeltaDist < (vExt.x * vExt.x * 4)) + //Debug.LogError("vExt.x * vExt.x * 4 = " + vExt.x * vExt.x * 4 + " fDeltaDist = " + fDeltaDist); + if (fDeltaDist < (vExt.x * vExt.x * 4)) { //Debug.LogError("set bPull = false"); + vFinalPos.y -= CDRInfo.fStepHeight; bPull = false; } }