fixed movement
This commit is contained in:
14
Entity.cs
14
Entity.cs
@@ -19,8 +19,8 @@ namespace Voxel
|
||||
|
||||
private float _gravity = 0.08f;
|
||||
private float _terminalVelocity = -3.92f;
|
||||
private float _airMultiplier = 0.98f;
|
||||
private float _groundMultiplier = 0.91f;
|
||||
private float _airMultiplier = 0.91f;
|
||||
private float _groundMultiplier = 0.6f;
|
||||
|
||||
private const float COLLISION_EPSILON = 0.01f;
|
||||
|
||||
@@ -46,7 +46,9 @@ namespace Voxel
|
||||
if (!OnGround)
|
||||
{
|
||||
Vector3 acceleration = new Vector3(0, -_gravity, 0);
|
||||
Velocity = (Velocity + acceleration) * _airMultiplier;
|
||||
Velocity += acceleration;
|
||||
Velocity *= _airMultiplier;
|
||||
|
||||
|
||||
if (Velocity.Y < _terminalVelocity)
|
||||
{
|
||||
@@ -55,11 +57,7 @@ namespace Voxel
|
||||
}
|
||||
else
|
||||
{
|
||||
Velocity = new Vector3(
|
||||
Velocity.X * _groundMultiplier,
|
||||
0f,
|
||||
Velocity.Z * _groundMultiplier
|
||||
);
|
||||
Velocity = new Vector3(Velocity.X * _groundMultiplier, 0f, Velocity.Z * _groundMultiplier);
|
||||
}
|
||||
|
||||
UpdateOnGround();
|
||||
|
||||
Reference in New Issue
Block a user