# Make an object revolve around another object

I’m trying to make an object revolve around another. I thought it could be done using applyForce, but the object either doesn’t move much at all, or it revolves and slows down. Is there a way to make it revolve at a certain speed? Here is the code for it.

``````
-- revolution example test

-- Use this function to perform your initial setup
function setup()
--creating the object that will be revolved around
center = physics.body(CIRCLE, 40)
center.x = WIDTH/2
center.y = HEIGHT/2
center.type = STATIC

--creating the revolving object
asteroid = physics.body(CIRCLE, 40)
asteroid.x = 400
asteroid.y = 200
force = vec2(math.cos(asteroid.x),math.sin(asteroid.y))
asteroid:applyForce(force * 100) -- apply force from center of mass

joint = physics.joint(REVOLUTE,center,asteroid,vec2(center.x, center.y))

end

-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)

-- This sets the line thickness
strokeWidth(5)

ellipse(center.x,center.y, 40)
sprite("Space Art:Asteroid Small", asteroid.x, asteroid.y)

end
``````

.@evanlws12 I added displayMode(FULLSCREEN), asteroid.gravityScale=0, and changed the force*2000. Also see http://twolivesleft.com/Codea/Talk/discussion/comment/17036#Comment_17036

``````
displayMode(FULLSCREEN)

-- revolution example test

-- Use this function to perform your initial setup
function setup()
--creating the object that will be revolved around
center = physics.body(CIRCLE, 40)
center.x = WIDTH/2
center.y = HEIGHT/2
center.type = STATIC

--creating the revolving object
asteroid = physics.body(CIRCLE, 40)
asteroid.x = 400
asteroid.y = 200
force = vec2(math.cos(asteroid.x),math.sin(asteroid.y))
asteroid:applyForce(force * 2000) -- apply force from center of mass

joint = physics.joint(REVOLUTE,center,asteroid,vec2(center.x, center.y))
asteroid.gravityScale=0

end

-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)

-- This sets the line thickness
strokeWidth(5)