Răsfoiți Sursa

CharacterTest: Prevent bunny hopping on elevator going down

Jorrit Rouwe 1 an în urmă
părinte
comite
fa0222c44e
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      Samples/Tests/Character/CharacterTest.cpp

+ 1 - 1
Samples/Tests/Character/CharacterTest.cpp

@@ -94,7 +94,7 @@ void CharacterTest::HandleInput(Vec3Arg inMovementDirection, bool inJump, bool i
 		// Update velocity
 		Vec3 current_velocity = mCharacter->GetLinearVelocity();
 		Vec3 desired_velocity = sCharacterSpeed * movement_direction;
-		if (!desired_velocity.IsNearZero() || !mCharacter->IsSupported())
+		if (!desired_velocity.IsNearZero() || current_velocity.GetY() < 0.0f || !mCharacter->IsSupported())
 			desired_velocity.SetY(current_velocity.GetY());
 		Vec3 new_velocity = 0.75f * current_velocity + 0.25f * desired_velocity;