movement tiny cleanup

This commit is contained in:
2022-06-12 16:10:56 +03:00
parent b5e0ca8a20
commit 81d754c865

View File

@@ -58,6 +58,7 @@ namespace Game
private const float jumpBoostVelocity = 100f;
private const int jumpBoostMaxJumps = 2;
private const bool jumpStairBehavior = true;
private const bool jumpAdditive = true;
private const float maxAirSpeed = 320f;
private const float maxAirStrafeSpeed = 30f;
@@ -964,14 +965,18 @@ namespace Game
// Reset velocity from gravity
if (-Vector3.Dot(Gravity.Normalized, velocity) < 0 &&
Vector3.Dot(velocity, traceGround.hitNormal) < -0.1)
{
velocity = Vector3.ProjectOnPlane(velocity, traceGround.hitNormal);
}
velocity += Vector3.Up * jumpVel;
bool ktjump = true;
if (ktjump)
if (jumpAdditive)
{
velocity += Vector3.Up * jumpVel;
if (velocity.Y < jumpVel)
velocity.Y = jumpVel;
}
else
velocity = Vector3.Up * jumpVel;
onGround = false;