Hello People <img src="smileys/smiley4.gif" border="0" align="middle" /> ,
Long time I didn't ask a question !
I need to make a black hole physics for my game but i am stuck here
Let's say i have a planet in space and I control a black hole How can I make the planet turn around the black hole as in real life ( But without the spaguetti effect
Thank you very much !
Develop games in your browser. Powerful, performant & highly capable.
A tiled planet from actual size to one pixel.
A black hole reach radius.
Any planet that enters to the black hole radius would feel an atraction force to it, and the tile animation from planet would start.
You can do it with the physics behavior. Turn off gravity with the action "set world gravity to 0" and use "apply force toward position". The position is the black hole and the force would be something like k*1/distance(object.x, object.y, blackhole.x, blackhole.y). "k" is basically how strong the black hole is. Change "k" it to whatever value you like, a higher value should give good results.
The objects will just move toward the center of the black hole unless you give the objects some velocity 90 degrees from the direction to the blackhole.
Here is a further discription with some useful diagrams:
And here is where I got the gravity formula: