Magnet On Objects

If I had an object, say a ball that is named: ball

And I had another object that is just an image created with newImage that is named: magnet

How can I make that magnet image act like a magnet and pull that ball to it? I assume I’ll have to use some kind of function like applyForce, but I have no idea how to use that. I read the example about the applyForce function, but don’t know how I can attrack that ball when it is in range of this magnet.

Any help would be great. Thank you.

Matt [import]uid: 14084 topic_id: 7608 reply_id: 307608[/import]

Anyone have any ideas on this at all? A direction to go in? A link to any info, articles, etc? [import]uid: 14084 topic_id: 7608 reply_id: 27298[/import]

Maybe you could add gravity to the magnet so the ball is attracted to it?
Divide the magnet into rects with positive and negative sides and add opposite gravity to each side?

I’m just learning Lua and the Corona SDK so I’m not really sure but that’s what I would try at first. [import]uid: 34126 topic_id: 7608 reply_id: 27386[/import]

Sweet! I’ll try it and let you know what the outcome is. Thanks a lot for the good tip.

Matt [import]uid: 14084 topic_id: 7608 reply_id: 27403[/import]