NAME

Collision::2D::Collision - An object representing a collision betwixt 2 entities

DESCRIPTION

ATTRIBUTES

time

The time of collision. For example, cinsider a point-circle collision, where the point is moving towards the circle. $collision->time is the exact moment of collision between the two.

axis

The axis of collision. Basically a vector from one entity to the other. It depends entirely on how they collide.

If the collision involves a vertical or horizontal line, the axis will be 'x' or 'y'. If it's between a point or corner and a circle, it will be an arrayref, of the form [$x,$y].

This vector will not be normal (normal means of length 1). Collision::2D::normalize_vec($v) is provided for that purpose.

ent1, ent2
$collision->ent1

This is to provide some context for "axis". This is useful because dynamic_collision doesn't preserve the order of your entities.