Particle system improvements:

- particles can collide with the outer walls of the sub
- drag + waterdrag parameters
- fixed particles "twitching" when the submarine is moving fast
- submarine velocity only affects the initial velocity of the particles (i.e. accelerating the sub doesn't automatically accelerate them)
This commit is contained in:
Regalis
2016-09-21 19:45:20 +03:00
parent b01b52172a
commit 721f4ff5a6
10 changed files with 230 additions and 68 deletions
+12
View File
@@ -444,6 +444,18 @@ namespace Barotrauma
float wallImpact = Vector2.Dot(Velocity, -collisionNormal);
ApplyImpact(wallImpact, -collisionNormal, contact);
Vector2 n;
FixedArray2<Vector2> particlePos;
contact.GetWorldManifold(out n, out particlePos);
int particleAmount = (int)(wallImpact*10.0f);
for (int i = 0; i < particleAmount; i++)
{
var particle = GameMain.ParticleManager.CreateParticle("iceshards",
ConvertUnits.ToDisplayUnits(particlePos[0]) + Rand.Vector(Rand.Range(1.0f, 50.0f)),
Rand.Vector(Rand.Range(50.0f,500.0f)) + Velocity);
}
return true;
}