Gravity

What happens if you set gravity to (9.8, 9,8)on a circle and make it static, will that make the circle behave like the force of the gravity comes from the center( like earth gravity)?

Since it is possible to apply radial gravity with box2d, i figured it could also be done with corona with a line or two of code? I’m away from my mac for a week and this is really itching in my curious brain, has anyone tested this? [import]uid: 13560 topic_id: 8390 reply_id: 308390[/import]

You can think of gravity x and y directional force vector. +/- direction on x axis is left and right and +/- on y-axis is up and down. Static physics bodies are not affected by gravity and no you cannot have central gravity as you described. You can set a sensor body and have the sensor pull on other bodies. Difference of two objects(fake gravity center like sun and object such as crate) , normalize it, get a distance and apply force to an object towards the sun position. Your reference to radial gravity is exactly this method. :smiley:

For reference, download the cocos2d iphone and compile and run box2d testbed and look at sensor test. We can do something similar like this in corona too.

peace ! ^^
[import]uid: 13978 topic_id: 8390 reply_id: 30089[/import]

I’ve used Cocos2d and quite a lot and also box2d a little, but i get your point I’ll try the sensor part when I get a chance.

I figured since it is possible to “fake” certain behaviors by setting parameters to objects who normally should not have them and achieve the same effect as if you coded the gravity.

I also read a post a while ago about setting object to behave like magnets, I haven’t seen any samples of that being done with either Corona or Cocos2d. I guess that could be also achieved by using sensors?

/lano78 [import]uid: 13560 topic_id: 8390 reply_id: 30113[/import]