     clear: ->
       ctx.clearRect -ctx.width/2, -ctx.height/2, ctx.width, ctx.height
     keyup: (e) ->
-      if e.keyCode is 32 # space
-        paused = false
       controls.keyup e
     keydown: controls.keydown
 

  window.grid = new Grid 100, "#056"
  controls = new KeyboardControls

  window.rect = new Rectangle 100, 100, [0, 200], 0.3, "#F00"
  rect.inverseMass = 1/10
  floor = new Rectangle 800, 10, [0, -5], 0, "#888"
  paused = false

  _.extend ctx,
    update: ->
      rect.reset()
      rect.resetDebug()

      unless paused
        rect.integrate ctx.dt / 1000, controls
      contacts = rect.contactPoints(floor)

      if contacts.length > 0
        unless paused
          for c, i in contacts
            console.log "contact #{i}", c.normal, c.depth
        paused = true
    draw: ->
      grid.draw ctx
      rect.draw ctx

    for point in clipped
      depth = Vec.dotProduct(refNorm, point) - maxDepth
      if depth >= 0
        contacts.push new Contact(this, other, point, contactNormal, depth, 0.8)

    # For simplicity sake, only return the "deepest" contact point. Eventually
    # the physics engine will need to track more than one contact and update
