Ctrl+K

RealExplosion

Declaration

public sealed class tainicom.Aether.Physics2D.Common.PhysicsLogic.RealExplosion

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.

Inherits: tainicom.Aether.Physics2D.Common.PhysicsLogic.PhysicsLogic

Constructors

RealExplosion

void RealExplosion(World world)

Parameters:

Name Type Description
world tainicom.Aether.Physics2D.Dynamics.World

Fields

EdgeRatio

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

float EdgeRatio

IgnoreWhenInsideShape

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

bool IgnoreWhenInsideShape

MaxAngle

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

float MaxAngle

MaxShapes

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

int MaxShapes

MinRays

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

int MinRays

Methods

Activate

Activate the explosion at the specified position.

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

Parameters:

Name Type Description
pos Strawberry.Math.Vector2 The position where the explosion happens
radius System.Single The explosion radius
maxForce System.Single The explosion force at the explosion point (then is inversely proportional to the square of the distance)

Returns: A list of bodies and the amount of force that was applied to them.