Class RealExplosion
- Namespace
- Alis.Core.Physic.Common.PhysicsLogic
- Assembly
- Alis.dll
Creates a realistic explosion based on raycasting. Objects in the open will be affected, but objects behind static bodies will not. A body that is half in cover, half in the open will get half the force applied to the end in the open.
public sealed class RealExplosion : PhysicsLogicInheritance
Inherited Members
Constructors
RealExplosion(World)
Initializes a new instance of the Alis.Core.Physic.Common.PhysicsLogic.RealExplosion class
public RealExplosion(World world)Parameters
worldWorld-
The world
Fields
EdgeRatio
Ratio of arc length to angle from edges to first ray tested. Defaults to 1/40.
public float EdgeRatioField Value
IgnoreWhenInsideShape
Ignore Explosion if it happens inside a shape. Default value is false.
public bool IgnoreWhenInsideShapeField Value
MaxAngle
Max angle between rays (used when segment is large). Defaults to 15 degrees
public float MaxAngleField Value
MaxEdgeOffset
Two degrees: maximum angle from edges to first ray tested
private const float MaxEdgeOffset = 0.034906585Field Value
MaxShapes
Maximum number of shapes involved in the explosion. Defaults to 100
public int MaxShapesField Value
MinRays
How many rays per shape/body/segment. Defaults to 5
public int MinRaysField Value
_data
The shape data
private readonly List<ShapeData> _dataField Value
_rdc
The rdc
private readonly RayDataComparer _rdcField Value
Methods
Activate(Vector2, float, float)
Activate the explosion at the specified position.
public Dictionary<Fixture, Vector2> Activate(Vector2 pos, float radius, float maxForce)Parameters
posVector2-
The position where the explosion happens
radiusfloat-
The explosion radius
maxForcefloat-
The explosion force at the explosion point (then is inversely proportional to the square of the distance)
Returns
- Dictionary<Fixture, Vector2>
-
A list of bodies and the amount of force that was applied to them.