Giving physical objects their own gravitational force

I’m BRAND NEW to corona and I’m making a physics heavy game. I’ve been trying to create a an object that has its own gravitational pull and is able to draw in the physical objects around it.

EX. X = physical object and Y = physical object with gravity.
As objectX gets closer to objectY it needs to be pulled in or attracted to objectY, kind of like an orbital effect. EX2. Black Hole effect.

It’s impossible to do with corona’s built in gravity function as its only able to apply linear gravity universally and not radial gravity to individual objects.

I’ve theorized that it might be possible to do with the applyForce and sensor functions but I’m to much of a novice to do so.

Does anyone know how to do this?
Can you PLEASE provide examples and SAMPLE CODE!?

I’ve read ALL the forums and done plenty of research so please don’t just post a link to another forum. I just need ways and examples of how to do it.

Thanks [import]uid: 29896 topic_id: 6214 reply_id: 306214[/import]

If you have, for example, a circle set as a physics object and make it a sensor, then use apply force to affect, for example, radial gravity you should have plenty of success.

It will take effort and time, but you could also use Particle Candy, as found on the 3rd Party Tools page:

http://www.anscamobile.com/corona/tools/
http://www.x-pressive.com/ParticleCandy_Corona/

I have also posted some code on the forum for doing this independently:

http://developer.anscamobile.com/forum/2010/12/08/radial-gravity
http://developer.anscamobile.com/forum/2010/10/21/simple-draggable-fan-demo

Good luck.

matt [import]uid: 8271 topic_id: 6214 reply_id: 21395[/import]

There is a tutorial available for something like this now:

http://www.coronalabs.com/blog/2013/04/09/physics-radial-gravity-and-predicting-trajectory/

There is a tutorial available for something like this now:

http://www.coronalabs.com/blog/2013/04/09/physics-radial-gravity-and-predicting-trajectory/