diff --git a/Subsurface/Source/Characters/AI/IndoorsSteeringManager.cs b/Subsurface/Source/Characters/AI/IndoorsSteeringManager.cs index d5c045ee8..883022f5f 100644 --- a/Subsurface/Source/Characters/AI/IndoorsSteeringManager.cs +++ b/Subsurface/Source/Characters/AI/IndoorsSteeringManager.cs @@ -97,7 +97,7 @@ namespace Barotrauma diff.Y = 0.0f; } - if (diff.Length() < 0.01) return -host.Steering; + if (diff.LengthSquared() < 0.001f) return -host.Steering; return Vector2.Normalize(diff) * speed; } @@ -147,10 +147,8 @@ namespace Barotrauma var collider = character.AnimController.Collider; - Vector2 colliderBottom = character.AnimController.GetColliderBottom(); - if (Math.Abs(collider.SimPosition.X - currentPath.CurrentNode.SimPosition.X) < collider.radius*2 && - currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y && - currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + collider.height + collider.radius*2) + if (Math.Abs(collider.SimPosition.X - currentPath.CurrentNode.SimPosition.X) < collider.radius * 2 && + Math.Abs(collider.SimPosition.Y - currentPath.CurrentNode.SimPosition.Y) < collider.height / 2 + collider.radius) { currentPath.SkipToNextNode(); } @@ -167,8 +165,7 @@ namespace Barotrauma diff.X = 0.0f; //at the same height as the waypoint - if (currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y && - currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + collider.height + collider.radius * 2) + if (Math.Abs(collider.SimPosition.Y - currentPath.CurrentNode.SimPosition.Y) < collider.height / 2 + collider.radius) { float heightFromFloor = character.AnimController.GetColliderBottom().Y - character.AnimController.FloorY; diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs index af2737aad..2747c4fea 100644 --- a/Subsurface/Source/Characters/Animation/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -980,11 +980,7 @@ namespace Barotrauma Vector2 rayEnd = rayStart; rayEnd.Y -= Collider.height * 0.5f + Collider.radius + colliderHeightFromFloor*1.2f; - var lowestLimb = FindLowestLimb(); - - //TODO: use something like this instead of lowest limb, whenever we get to that - //float footY = Collider.SimPosition.Y + Collider.height * 0.5f + Collider.radius + ConvertUnits.ToSimUnits(45.0f); - + Vector2 colliderBottomDisplay = ConvertUnits.ToDisplayUnits(GetColliderBottom()); if (!inWater && levitatingCollider) { float closestFraction = 1.0f; @@ -995,11 +991,11 @@ namespace Barotrauma { case Physics.CollisionStairs: Structure structure = fixture.Body.UserData as Structure; - if (lowestLimb.Position.Y