Improved particle collision logic:

- checking if any of the extents of the particle collide with the edges of the hull, instead of just checking if a position in the direction the particle is heading is outside the hull
- separate fields for friction and restitution
This commit is contained in:
Regalis
2017-05-18 20:03:58 +03:00
parent 2aa0f3ac15
commit 89bd2b1a98
5 changed files with 97 additions and 60 deletions
@@ -38,6 +38,7 @@ namespace Barotrauma.Particles
public readonly bool DeleteOnCollision;
public readonly bool CollidesWithWalls;
public readonly float Friction;
public readonly float Restitution;
public readonly Vector2 VelocityChange;
@@ -107,6 +108,7 @@ namespace Barotrauma.Particles
Drag = ToolBox.GetAttributeFloat(element, "drag", 0.0f);
WaterDrag = ToolBox.GetAttributeFloat(element, "waterdrag", 0.0f);
Friction = ToolBox.GetAttributeFloat(element, "friction", 0.5f);
Restitution = ToolBox.GetAttributeFloat(element, "restitution", 0.5f);
switch (ToolBox.GetAttributeString(element, "blendstate", "alphablend"))