(b00ce5ec2) Fixed character's feet levitating when standing at the base of a staircase without climbing it. Closes #1275

This commit is contained in:
Joonas Rikkonen
2019-04-05 16:21:41 +03:00
parent 6199f68999
commit 6fed28e80b
5 changed files with 88 additions and 119 deletions
@@ -599,7 +599,7 @@ namespace Barotrauma
waist.PullJointEnabled = true;
}
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f), ignoreStairs: Stairs == null);
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
if (Stairs != null || onSlope)
@@ -1391,14 +1391,14 @@ namespace Barotrauma
partial void Splash(Limb limb, Hull limbHull);
protected float GetFloorY(Limb refLimb = null)
protected float GetFloorY(Limb refLimb = null, bool ignoreStairs = false)
{
PhysicsBody refBody = refLimb == null ? Collider : refLimb.body;
return GetFloorY(refBody.SimPosition);
return GetFloorY(refBody.SimPosition, ignoreStairs);
}
protected float GetFloorY(Vector2 simPosition)
protected float GetFloorY(Vector2 simPosition, bool ignoreStairs = false)
{
Vector2 rayStart = simPosition;
float height = ColliderHeightFromFloor;
@@ -1415,6 +1415,7 @@ namespace Barotrauma
switch (fixture.CollisionCategories)
{
case Physics.CollisionStairs:
if (ignoreStairs) return -1;
if (inWater && TargetMovement.Y < 0.5f) return -1;
break;
case Physics.CollisionPlatform: