Item.SetTransform uses SetTransformIgnoreContacts to set the position of the physics body if the body is disabled. No need to update contacts when moving disabled items such as wearables.

This commit is contained in:
Joonas Rikkonen
2018-02-13 13:54:09 +02:00
parent 76f5c099ed
commit a2c898150e
2 changed files with 18 additions and 2 deletions

View File

@@ -528,7 +528,14 @@ namespace Barotrauma
{
try
{
body.SetTransform(simPosition, rotation);
if (body.Enabled)
{
body.SetTransform(simPosition, rotation);
}
else
{
body.SetTransformIgnoreContacts(simPosition, rotation);
}
}
catch (Exception e)
{

View File

@@ -396,11 +396,20 @@ namespace Barotrauma
System.Diagnostics.Debug.Assert(Math.Abs(simPosition.X) < 1000000.0f);
System.Diagnostics.Debug.Assert(Math.Abs(simPosition.Y) < 1000000.0f);
body.SetTransform(simPosition, rotation);
SetPrevTransform(simPosition, rotation);
}
public void SetTransformIgnoreContacts(Vector2 simPosition, float rotation)
{
System.Diagnostics.Debug.Assert(MathUtils.IsValid(simPosition));
System.Diagnostics.Debug.Assert(Math.Abs(simPosition.X) < 1000000.0f);
System.Diagnostics.Debug.Assert(Math.Abs(simPosition.Y) < 1000000.0f);
body.SetTransformIgnoreContacts(ref simPosition, rotation);
SetPrevTransform(simPosition, rotation);
}
public void SetPrevTransform(Vector2 position, float rotation)
{
prevPosition = position;