How would I move an object around in a circle?

I don’t mean make it spin or anything like that. I just want it to move round in a circular path.

Any help would be appreciated.

Mike [import]uid: 9950 topic_id: 17117 reply_id: 317117[/import]

Use the Physics engine pivot joints. An example is located here:
http://developer.anscamobile.com/code/orbital-rotation

-David
[import]uid: 96411 topic_id: 17117 reply_id: 64379[/import]

You can also use a bit of trigonometry and set the position (even based on time elapsed for more accurate granularity)

or you can use physics, you could use that sample, you can also create a pivot joint and add a motor. However you will still have to move your objects if you offset the main body around which they are all moving.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 17117 reply_id: 64396[/import]

Are you looking for something like this one? See below.

Naomi

[lua]-- The circle is white, so if the background is white, you won’t see anything, but here you go:
local myObject = display.newCircle(50, 50, 12);
myObject.xReference = 50;
myObject.yReference = 50;
myObject.rotation = 0;
local function rotateMyObject()
myObject.rotation = myObject.rotation + 2;
end
Runtime:addEventListener( “enterFrame”, rotateMyObject ); [/lua]
[import]uid: 67217 topic_id: 17117 reply_id: 64415[/import]

Naomi, That is exactly what I was looking for.

Thank you.

Mike [import]uid: 9950 topic_id: 17117 reply_id: 64464[/import]

If you want to know more about this. You can find a good website and it cater a lot of tutorial of corona sdk.

You can find a very good tutorial related to x, yReference and Rotation. This tutorial also help me to build my app with rotation too. Please find details below link info.

Hope this help.

KC

http://www.learningcorona.com/

Corona SDK Screencasts by Rafael Hernandez
Lesson 12: x and yReference Properties and Rotation
link of the lesson 12
http://www.youtube.com/watch?v=sKAWaLLG9vQ [import]uid: 94613 topic_id: 17117 reply_id: 65409[/import]

If you want to *move* an object in a circular manner you would use math.sin and math.cos (sine and cosine) functions. If you simply want it to rotate in a circular manner the advice above is sufficient :slight_smile: [import]uid: 84637 topic_id: 17117 reply_id: 66022[/import]

Here is a good example:
http://www.youtube.com/watch?v=sKAWaLLG9vQ
hope it’s what you’re looking for.

Good luck,
J.K. [import]uid: 66117 topic_id: 17117 reply_id: 66026[/import]