Class: CollisionInfo

CollisionInfo() → {CollisionInfo}

Encapsulates collision resolution information, all properties are zeroed until set

Found in Chapter 9, page 550 of the textbook

Examples: 9.2 Circle Collision Info 9.8 Collision Angular Resolution

Constructor

new CollisionInfo() → {CollisionInfo}

Source:
Returns:
a new CollisionInfo instance
Type
CollisionInfo

Methods

changeDir()

Reverses the direction of the interpenetration resolution this CollisionInfo encapsulates
Source:

draw(aCamera)

Draw a line on aCamera that shows this CollisionInfo
Parameters:
Name Type Description
aCamera Camera the Camera to draw to
Source:

getDepth() → {float}

Returns the interpenetration depth between the colliding shapes
Source:
Returns:
mDepth - interpenetration depth
Type
float

getEnd() → {vec2}

Returns the ending [X,Y] position for this CollisionInfo
Source:
Returns:
mEnd - ending position
Type
vec2

getNormal() → {vec2}

Returns the normal vector for this CollisionInfo
Source:
Returns:
mNormal - the normal vector
Type
vec2

getStart() → {vec2}

Returns the starting [X,Y] position for this CollisionInfo
Source:
Returns:
mStart - starting position
Type
vec2

setDepth(s)

Sets the interpenetration depth between the colliding shapes
Parameters:
Name Type Description
s float the new interpenetration depth
Source:

setInfo(d, n, s)

Sets all the properties that describe this CollisionInfo. Calculates ending position based on starting position, normal vector, and depth
Parameters:
Name Type Description
d float the depth of interpenetration between the shapes
n vec2 the normal vector for the collision
s vec2 the [X,Y] starting position in world coordinates
Source:

setNormal(s)

Sets the normal vector for this CollisionInfo
Parameters:
Name Type Description
s vec2 the new normal vector
Source: