(961d41b31) Ragdoll syncing improvements: - Don't ignore platforms when correcting a ragdoll's position using Ragdoll.SetPosition. Otherwise forcing the character above a platform may cause it to drop down again if the feet don't end up above the platform. - Correct ragdoll position to server position immediately if the error is very large. - Force collider to stay upright after fixed rotation is enabled.
This commit is contained in:
@@ -379,7 +379,6 @@ namespace Barotrauma
|
||||
{
|
||||
//rotate collider back upright
|
||||
Collider.AngularVelocity = MathUtils.GetShortestAngle(Collider.Rotation, 0.0f) * 10.0f;
|
||||
|
||||
Collider.FarseerBody.FixedRotation = false;
|
||||
}
|
||||
else
|
||||
@@ -387,6 +386,14 @@ namespace Barotrauma
|
||||
Collider.FarseerBody.FixedRotation = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float angleDiff = MathUtils.GetShortestAngle(Collider.Rotation, 0.0f);
|
||||
if (Math.Abs(angleDiff) > 0.001f)
|
||||
{
|
||||
Collider.SetTransform(Collider.SimPosition, Collider.Rotation + angleDiff);
|
||||
}
|
||||
}
|
||||
|
||||
if (character.LockHands)
|
||||
{
|
||||
|
||||
@@ -1450,7 +1450,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPosition(Vector2 simPosition, bool lerp = false)
|
||||
public void SetPosition(Vector2 simPosition, bool lerp = false, bool ignorePlatforms = true)
|
||||
{
|
||||
if (!MathUtils.IsValid(simPosition))
|
||||
{
|
||||
@@ -1481,18 +1481,18 @@ namespace Barotrauma
|
||||
//check visibility from the new position of the collider to the new position of this limb
|
||||
Vector2 movePos = limb.SimPosition + limbMoveAmount;
|
||||
|
||||
TrySetLimbPosition(limb, simPosition, movePos, lerp);
|
||||
TrySetLimbPosition(limb, simPosition, movePos, lerp, ignorePlatforms);
|
||||
}
|
||||
}
|
||||
|
||||
protected void TrySetLimbPosition(Limb limb, Vector2 original, Vector2 simPosition, bool lerp = false)
|
||||
protected void TrySetLimbPosition(Limb limb, Vector2 original, Vector2 simPosition, bool lerp = false, bool ignorePlatforms = true)
|
||||
{
|
||||
Vector2 movePos = simPosition;
|
||||
|
||||
if (Vector2.DistanceSquared(original, simPosition) > 0.0001f)
|
||||
{
|
||||
Category collisionCategory = Physics.CollisionWall | Physics.CollisionLevel;
|
||||
//if (!ignorePlatforms) collisionCategory |= Physics.CollisionPlatform;
|
||||
if (!ignorePlatforms) { collisionCategory |= Physics.CollisionPlatform; }
|
||||
|
||||
Body body = Submarine.PickBody(original, simPosition, null, collisionCategory);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user