Table of Contents

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 : PhysicsLogic

Inheritance

Inherited Members

Constructors

RealExplosion(World)

Initializes a new instance of the Alis.Core.Physic.Common.PhysicsLogic.RealExplosion class

public RealExplosion(World world)

Parameters

world World

The world

Fields

EdgeRatio

Ratio of arc length to angle from edges to first ray tested. Defaults to 1/40.

public float EdgeRatio

Field Value

float

IgnoreWhenInsideShape

Ignore Explosion if it happens inside a shape. Default value is false.

public bool IgnoreWhenInsideShape

Field Value

bool

MaxAngle

Max angle between rays (used when segment is large). Defaults to 15 degrees

public float MaxAngle

Field Value

float

MaxEdgeOffset

Two degrees: maximum angle from edges to first ray tested

private const float MaxEdgeOffset = 0.034906585

Field Value

float

MaxShapes

Maximum number of shapes involved in the explosion. Defaults to 100

public int MaxShapes

Field Value

int

MinRays

How many rays per shape/body/segment. Defaults to 5

public int MinRays

Field Value

int

_data

The shape data

private readonly List<ShapeData> _data

Field Value

List<ShapeData>

_rdc

The rdc

private readonly RayDataComparer _rdc

Field Value

RayDataComparer

Methods

Activate(Vector2, float, float)

Activate the explosion at the specified position.

public Dictionary<Fixture, Vector2> Activate(Vector2 pos, float radius, float maxForce)

Parameters

pos Vector2

The position where the explosion happens

radius float

The explosion radius

maxForce float

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.