# 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.x = balls.x + rsteer.x*10
balls.y = balls.y + rsteer.y*10
balls.x = balls.x + lsteer.x*10
balls.y = balls.y + lsteer.y*10

noStroke()

fill(balls.color)
fill(balls.color)

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!