Repelling bodies

I was working on some code where I have two circles that push each other around, and to make that happen I make physics bodies under the assumption that they would repel each other.

At first they bump into each other, but then they go right through each other and I can’t figure out why.


--# Main
-- Colliding Balls

function setup() 
    ball1 = physics.body(CIRCLE,75)
    ball1.gravityScale = 0
    ball1.x=300
    ball1.y=600
    
    ball2 = physics.body(CIRCLE,75)
    ball2.gravityScale = 0
    ball2.x=120
    ball2.y=400
    
    balls = {{ball1, color = color(255,0,0)}, {ball2, color = color(0,255,255)}}
    
    lsteer = vec2(0,0)
    rsteer = vec2(0,0)
    
    controller1 = VirtualStick {
        moved = function(v) lsteer = v end,
        released = function(v) lsteer = vec2(0,0) end,
        x0=0,x1=0.5,y0=0,y1=1}

    controller2 = VirtualStick {
        moved = function(v) rsteer = v end,
        released = function(v) rsteer = vec2(0,0) end,
        x0=0.5,x1=1,y0=0,y1=1}
    
    allControllers = All({controller1, controller2})
end

function draw()
    background(30, 30, 30, 25)
    
    balls[1][1].x = balls[1][1].x + rsteer.x*10
    balls[1][1].y = balls[1][1].y + rsteer.y*10
    balls[2][1].x = balls[2][1].x + lsteer.x*10
    balls[2][1].y = balls[2][1].y + lsteer.y*10
    
    noStroke()
    
    fill(balls[1].color)
    ellipse(balls[1][1].x, balls[1][1].y, balls[1][1].radius*2)
    fill(balls[2].color)
    ellipse(balls[2][1].x, balls[2][1].y, balls[2][1].radius*2)  
    
    allControllers:draw()
end

function touched(touch)
    allControllers:touched(touch)
end

Note: this code uses @Jmv38’s modifies version of @Nat’s controllers
http://twolivesleft.com/Codea/Talk/discussion/comment/14969#Comment_14969

add these lines in setup

ball1.sleepingAllowed=false
ball2.sleepingAllowed=false

Ah, I was wondering why my objects sometimes went through each other, thank you @dave1707

Awesome, thanks!