Fixed "trying to move pulljoint extremely far" errors when using a controller that's in a different sub (or inside when the character is outside, or vice versa).
This commit is contained in:
@@ -142,15 +142,16 @@ namespace Barotrauma.Items.Components
|
||||
foreach (LimbPos lb in limbPositions)
|
||||
{
|
||||
Limb limb = character.AnimController.GetLimb(lb.limbType);
|
||||
if (limb == null) continue;
|
||||
if (limb == null || !limb.body.Enabled) continue;
|
||||
|
||||
limb.Disabled = true;
|
||||
|
||||
Vector2 position = ConvertUnits.ToSimUnits(lb.position + new Vector2(item.Rect.X, item.Rect.Y));
|
||||
Vector2 worldPosition = lb.position + new Vector2(item.WorldRect.X, item.WorldRect.Y);
|
||||
Vector2 diff = worldPosition - limb.WorldPosition;
|
||||
|
||||
limb.PullJointEnabled = true;
|
||||
limb.PullJointWorldAnchorB = position;
|
||||
}
|
||||
|
||||
limb.PullJointWorldAnchorB = limb.SimPosition + ConvertUnits.ToSimUnits(diff);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character activator = null)
|
||||
|
||||
Reference in New Issue
Block a user