[Resolved] Confine physics objects to a specifc area.. say a Circle.

Hi I have some small items moving around the screen, by randomly changing the setgravity() property

But I want these items to stay with in a boundry … specifically a circle.

Do I draw an object in a physics editor, that has a hallowed out circular inner and place that over the top of my gravity objects.
or is there some way of drawing a circle in lua, and setting it as some sort of boundary item?

Thanks

Aidan [import]uid: 102413 topic_id: 24341 reply_id: 324341[/import]

You could use math and a Runtime listener to keep them within the circle or you could draw a hollow circle with physics editor as you mentioned :slight_smile: [import]uid: 52491 topic_id: 24341 reply_id: 98449[/import]

…I was afraid you might say that!.. math. Dont suppose you could point me in the direction of the math I might need? [import]uid: 102413 topic_id: 24341 reply_id: 98477[/import]

Hey Aidan,

I believe it might actually be done as in this thread; http://developer.anscamobile.com/forum/2011/09/23/position-within-radius-or-area

I had something more complex in mind but I think that is the kind of thing you are after - although rather than printing you’d obviously use it differently.

Let me know if that helps :slight_smile:

Peach [import]uid: 52491 topic_id: 24341 reply_id: 98692[/import]

Hey, thanks for finding me this peach.
Just the ticket
The contentsBounds property will be useful to no end.
Thanks [import]uid: 102413 topic_id: 24341 reply_id: 98853[/import]

Not a problem Aidan, good luck with your project! [import]uid: 52491 topic_id: 24341 reply_id: 98943[/import]