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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user