fix: update logic move HP.
This commit is contained in:
@@ -167,14 +167,16 @@ namespace BrewMonster.Scripts
|
||||
bool bJump = (fYVel > 0.5f);
|
||||
|
||||
Vector3 vVelocity = CDRInfo.fSpeed * new Vector3(CDRInfo.vXOZVelDir.x, 0f, CDRInfo.vXOZVelDir.z) + fYVel * Vector3.up;
|
||||
|
||||
|
||||
if (bFreeFall)
|
||||
{
|
||||
vVelocity += -CDRInfo.fGravityAccel * CDRInfo.t * Vector3.up;
|
||||
fYVel += -CDRInfo.fGravityAccel * CDRInfo.t;
|
||||
}
|
||||
|
||||
Vector3 vVelDir = vVelocity;
|
||||
float fVelSpeed = vVelDir.magnitude;
|
||||
vVelDir = vVelDir.normalized;
|
||||
if (fVelSpeed > 1e-6f)
|
||||
{
|
||||
vVelDir /= fVelSpeed;
|
||||
@@ -218,9 +220,9 @@ 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;
|
||||
bool hasHit = Physics.Raycast(posFoot, vVelocity.normalized, out RaycastHit hit, fDeltaDist, mask);
|
||||
bool bClear = !Physics.Raycast(posFoot, vVelocity.normalized, out RaycastHit hit, fDeltaDist, mask);
|
||||
nTry++;
|
||||
if (!hasHit)
|
||||
if (bClear)
|
||||
{
|
||||
vFinalPos = vStart + vDelta;
|
||||
CDRInfo.fMoveDist += fDeltaDist;
|
||||
@@ -257,10 +259,6 @@ namespace BrewMonster.Scripts
|
||||
if (!bMove)
|
||||
{
|
||||
//vDelta2 *= frac2;
|
||||
vFinalPos -= Vector3.up * CDRInfo.fStepHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
vFinalPos = hit.point + Vector3.up * vExt.y;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user