The lowest point of a character collider is calculated from its AABB (works correctly now even if the collider is rotated, allowing prone characters to be dragged through stairs), dragged characters collide with stairs when climbing up, the AI of unconscious or stunned characters isn't updated
This commit is contained in:
@@ -1268,10 +1268,26 @@ namespace Barotrauma
|
||||
{
|
||||
float halfHeight = Collider.height * 0.5f + Collider.radius;
|
||||
|
||||
Vector2 offset = Vector2.Zero;
|
||||
offset.Y = -colliderHeightFromFloor;
|
||||
return Collider.SimPosition + offset +
|
||||
new Vector2((float)Math.Sin(Collider.Rotation), -(float)Math.Cos(Collider.Rotation)) * halfHeight;
|
||||
float offset = 0.0f;
|
||||
|
||||
if (!character.IsUnconscious && !character.IsDead && character.Stun <= 0.0f)
|
||||
{
|
||||
offset = -colliderHeightFromFloor;
|
||||
}
|
||||
|
||||
float lowestBound = Collider.SimPosition.Y;
|
||||
for (int i = 0; i < Collider.FarseerBody.FixtureList.Count; i++)
|
||||
{
|
||||
FarseerPhysics.Collision.AABB aabb;
|
||||
FarseerPhysics.Common.Transform transform;
|
||||
|
||||
Collider.FarseerBody.GetTransform(out transform);
|
||||
Collider.FarseerBody.FixtureList[i].Shape.ComputeAABB(out aabb, ref transform, i);
|
||||
|
||||
lowestBound = Math.Min(aabb.LowerBound.Y, lowestBound);
|
||||
}
|
||||
|
||||
return new Vector2(Collider.SimPosition.X, lowestBound + offset);
|
||||
}
|
||||
|
||||
public Limb FindLowestLimb()
|
||||
|
||||
Reference in New Issue
Block a user