Procházet zdrojové kódy

Bugfix: It was possible to trigger an assert in CharacterVirtual, changed to early out

Jorrit Rouwe před 2 roky
rodič
revize
57190cd0ab
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      Jolt/Physics/Character/CharacterVirtual.cpp

+ 2 - 1
Jolt/Physics/Character/CharacterVirtual.cpp

@@ -1179,7 +1179,8 @@ bool CharacterVirtual::WalkStairs(float inDeltaTime, Vec3Arg inStepUp, Vec3Arg i
 			&& c.mSurfaceNormal.Dot(horizontal_velocity - c.mLinearVelocity) < 0.0f // Pushing into the contact
 			&& IsSlopeTooSteep(c.mSurfaceNormal)) // Slope too steep
 			steep_slope_normals.push_back(c.mSurfaceNormal);
-	JPH_ASSERT(!steep_slope_normals.empty(), "CanWalkStairs should have returned false!");
+	if (steep_slope_normals.empty())
+		return false; // No steep slopes, cancel
 
 	// Horizontal movement
 	RVec3 new_position = up_position;