@@ -1809,7 +1809,6 @@ void AHuman::UpdateWalkAngle(AHuman::Layer whichLayer) {
1809
1809
if (m_Controller.IsState (BODY_JUMP)) {
1810
1810
m_WalkAngle[whichLayer] = Matrix (c_QuarterPI * GetFlipFactor ());
1811
1811
} else {
1812
- // Cast rays to calculate the approximate shape of terrain.
1813
1812
int rayCount = 4 ;
1814
1813
float rayLength = 10 .0F ;
1815
1814
Vector hipPos = m_Pos;
@@ -1820,15 +1819,15 @@ void AHuman::UpdateWalkAngle(AHuman::Layer whichLayer) {
1820
1819
rayLength += m_pBGLeg->GetMaxLength ();
1821
1820
hipPos += RotateOffset (m_pBGLeg->GetParentOffset ());
1822
1821
}
1823
- float traceRotation = rayCount > 1 ? c_HalfPI / static_cast <float >(rayCount - 1 ) * GetFlipFactor () : 0 ;
1822
+ float traceRotation = c_HalfPI / static_cast <float >(rayCount - 1 ) * GetFlipFactor ();
1824
1823
Vector hitPos;
1825
1824
Vector terrainVector (0 , rayLength);
1826
1825
Vector trace (0 , rayLength);
1827
1826
for (int i = 0 ; i < rayCount; i++) {
1828
1827
if (g_SceneMan.CastStrengthRay (hipPos, trace, 10 .0F , hitPos, 4 , g_MaterialGrass)) {
1829
1828
terrainVector += trace - g_SceneMan.ShortestDistance (hipPos, hitPos, g_SceneMan.SceneWrapsX ());
1830
1829
} else {
1831
- // Reinforce focus on previously assumed terrain.
1830
+ // Since no terrain was found, reinforce the existing terrain direction Vector, so any terrain found in future affects it less .
1832
1831
terrainVector *= 1 .5F ;
1833
1832
}
1834
1833
trace.RadRotate (traceRotation);
@@ -3630,15 +3629,15 @@ void AHuman::Update()
3630
3629
}
3631
3630
bool climbing = m_ArmClimbing[FGROUND] || m_ArmClimbing[BGROUND];
3632
3631
3633
- if (restarted) {
3632
+ if (restarted) {
3634
3633
if (!climbing) {
3635
3634
if (m_StrideSound) { m_StrideSound->Play (m_Pos); }
3636
3635
RunScriptedFunctionInAppropriateScripts (" OnStride" );
3637
3636
} else {
3638
3637
m_WalkAngle[FGROUND] = Matrix ();
3639
3638
m_WalkAngle[BGROUND] = Matrix ();
3640
3639
}
3641
- }
3640
+ }
3642
3641
3643
3642
// //////////////////////////////////////
3644
3643
// Arm Climbing if the leg paths failed to find clear spot to restart
0 commit comments