Skip to main content
1 of 3

2D Collision response - rotating, moving polygon hitting a wall

I'm trying to bounce a polygon that has both velocity and angular velocity off a (immovable) wall when one of the vertices collides with it. I've worked out how to calculate the inputs and know what outputs I need, but haven't been able to find or work out an implementation. Any help would be greatly appreciated.

function collisionResponse(
    c, // object center of mass position
    v, // velocity of object
    a, // the angular velocity of the object
    p, // point of contact with line
    n  // normalized normal of line
) {
    // magic happens..

    result.v = ?? // resulting object velocity
    result.a = ?? // resulting object angular velocity
    return result;
}