fix: fix bug move on ground.

This commit is contained in:
Tungdv
2025-12-13 19:11:38 +07:00
parent 65cb2fa69d
commit d1d59c6d04
6 changed files with 46 additions and 11 deletions
+24 -3
View File
@@ -287,6 +287,21 @@ namespace BrewMonster.Scripts
//bool hasHit = CollideWithEnv_BoxCast(vStart, vDelta, vExt, mask,
// out RaycastHit hit, out float fFraction, out Vector3 hitNormal, out bool bStartSolid);
Vector3 posFoot = vStart - Vector3.up * vExt.y;
//if (Physics.BoxCast(vStart, vExt, (vStart + Vector3.down).normalized, out RaycastHit hit1, Quaternion.identity, vExt.y, mask))
//{
// if (hit1.point.y > posFoot.y)
// {
// Debug.LogError("hit.point.y > posFoot.y");
// posFoot.y = hit1.point.y;
// }
//}
if (Physics.Raycast(vStart, (vStart + Vector3.down).normalized, out RaycastHit hit1, vExt.y, mask))
{
if (hit1.point.y > posFoot.y)
{
posFoot.y = hit1.point.y;
}
}
bool bClear = !Physics.Raycast(posFoot, (posFoot + vDelta).normalized, out RaycastHit hit, fDeltaDist, mask);
nTry++;
if (bClear)
@@ -302,8 +317,6 @@ namespace BrewMonster.Scripts
// if (CDRInfo.vTPNormal.y < CDRInfo.fSlopeThresh) CDRInfo.vTPNormal = Vector3.up;
// return;
//}
Debug.DrawLine(posFoot, hit.point, Color.green, 10f);
vStart = hit.point + Vector3.up * vExt.y;
vFinalPos = vStart;
//CDRInfo.fMoveDist += (fDeltaDist * fFraction);
@@ -316,7 +329,15 @@ namespace BrewMonster.Scripts
//float skin = 0.01f;
posFoot = vStart - Vector3.up * vExt.y + Vector3.up * CDRInfo.fStepHeight;
Vector3 vStartUp = new Vector3(0f, CDRInfo.fStepHeight, 0f);
bPull = !Physics.Raycast(posFoot, (posFoot + vStartUp).normalized, out hit, CDRInfo.fStepHeight, mask);
//if (Physics.Raycast(vStart, (vStart + Vector3.down).normalized, out hit1, vExt.y, mask))
//{
// if (hit1.point.y > posFoot.y)
// {
// Debug.LogError("hit.point.y > posFoot.y");
// posFoot.y = hit1.point.y + CDRInfo.fStepHeight;
// }
//}
bPull = !Physics.Raycast(posFoot, (Vector3.up).normalized, out hit, CDRInfo.fStepHeight, mask);
if (bPull)
{
vStart += Vector3.up * CDRInfo.fStepHeight;
@@ -577,9 +577,9 @@ namespace CSNetwork
if (pCmd.iMessage != 0)
{
string szMsg = m_ErrorMsgs.GetWideString(pCmd.iMessage);
if (string.IsNullOrEmpty(szMsg))
BMLogger.LogError("SERVER - unknown error !");
//string szMsg = m_ErrorMsgs.GetWideString(pCmd.iMessage);
//if (string.IsNullOrEmpty(szMsg))
// BMLogger.LogError("SERVER - unknown error !");
//else if (pCmd.iMessage != 2)
//g_pGame->GetGameRun()->AddChatMessage(szMsg, GP_CHAT_MISC);
}
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7d0c92bda31fb016ed4bbb1b3670ed7cce73d854e25ddac2abb3d36277a2e4a2
size 200515696
oid sha256:5f0e60c802cf01eacf4cb214f00e8b7e04dcae61d68d6ed1ce599f2ee0f09db9
size 200516379
+2 -1
View File
@@ -48,7 +48,8 @@ public partial class CECGameRun
// glb_ErrorOutput(ECERR_FAILEDTOCALL, "CECGameRun::Init", __LINE__);
// return false;
//}
m_InstTab.Add(161, new CECInstance());
if(!m_InstTab.ContainsKey(161))
m_InstTab.Add(161, new CECInstance());
AddressableManager.Instance.OnDispose += Dispose;
}
+14 -1
View File
@@ -417,6 +417,7 @@ namespace BrewMonster
case int value when value == EC_MsgDef.MSG_HST_STOPATTACK: OnMsgHstStopAttack(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_SKILLRESULT: OnMsgHstSkillResult(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_OWNEXTPROP: OnMsgHstExtProp(Msg); break;
case int value when value == EC_MsgDef.MSG_HST_TARGETISFAR: OnMsgHstTargetIsFar(Msg); break;
}
@@ -3486,7 +3487,19 @@ namespace BrewMonster
m_BasicProps.iResilience = pCmd.resilience;
m_BasicProps.iVigour = pCmd.vigour;
}
}
void OnMsgHstTargetIsFar( ECMSG Msg)
{
// TO DO: fix later
//if(CmdNormalAttack(true, m_pComboSkill != null, 0, -1) )
// AP_ActionEvent(AP_EVENT_MELEEOUTOFRANGE, 1);
if (CmdNormalAttack(true, false, 0, -1))
{
//AP_ActionEvent(AP_EVENT_MELEEOUTOFRANGE, 1);
}
}
}
public enum StateAnim
{
+1 -1
View File
@@ -12,7 +12,7 @@ TagManager:
- Water
- UI
- Terrain
- Bush
- Brush
-
-
-