Particles that rotate towards the movement direction use sub-relative movement when inside the sub (weld/cut particles don't face the movement direction of the submarine anymore).

This commit is contained in:
Joonas Rikkonen
2018-02-13 13:50:41 +02:00
parent 4d01aba0f1
commit 76f5c099ed

View File

@@ -168,7 +168,12 @@ namespace Barotrauma.Particles
{
if (velocityChange != Vector2.Zero || angularVelocity != 0.0f)
{
rotation = MathUtils.VectorToAngle(new Vector2(velocity.X, -velocity.Y));
Vector2 relativeVel = velocity;
if (currentHull?.Submarine != null)
{
relativeVel -= ConvertUnits.ToDisplayUnits(currentHull.Submarine.Velocity);
}
rotation = MathUtils.VectorToAngle(new Vector2(relativeVel.X, -relativeVel.Y));
}
}
else