Author: Murii
DO NOT call this
DO NOT call this
function Collision:setGravity(value)
set the gravity for the hole world
function Collision:setMaxVelocity(value)
set the max velocity an object can reach
function Collision:clamp(n, low, high)
clamps number between two values
function Collision:clampVec(x, y, len)
clamps vector size if above a given length
function Collision:findShape(s)
returns shape index and its list
function Collision:removeShape(s)
removes shape from its list
function Collision:getBounds(s)
returns center position and half width/height extents for any shape
function Collision.getBounds(s)
returns center position and half width/height extents for any shape
function Collision.repartition(s)
repartition moved or modified shapes
function Collision:testPoint(s, x, y, line)
tests a point versus any shape
function Collision:queryPoint(result, x, y)
test a point versus all shapes
function Collision:queryShape(result, a, dt)
test a shape versus all shapes
function Collision.addRectShape(list, x, y, w, h)
rects have a center position and half-width/height extents
function Collision.addCircleShape(list, x, y, r)
circles have a center position and radius
function Collision.addLineShape(list, x, y, x2, y2)
line shapes have a starting and an ending point
function testRectRect(a, b, dt)
tests two rectangles for intersection
function testRectCircle(a, b, dt)
tests rectangle versus circle
tests rectangle versus line segment
function testCircleCircle(a, b, dt)
tests two circles
function testCircleLine(a, b, dt)
tests circle versus a line segment
function Collision:testShapes(a, b, dt)
returns normalized separation vector and penetration
function Collision:moveShape(a, dx, dy)
moves shape by given amount without checking for collisions
function Collision:positionShape(a, x, y)
repositions the shape to given coordinates
function Collision:getVelocity(a)
returns the velocity of shape
function Collision:setVelocity(a, xv, yv)
assigns velocity to shape
function Collision:update(delta)
updates the simulation
function Collision:collision(a, b)
check and report collisions
function Collision:solveCollision(a, b, nx, ny, pen)
resolves collisions