Per object gravity?

I was just wondering if it was possible for objects to have their own gravity independent of other objects?
So I could have one object that has a gravity of 4 and another with a gravity of 1.

Thanks

No, gravity is a universal settings (as in real life!)... however, you can modify the densities of physical objects which would affect gravity in a way.

Another solution might be to attach an enterFrame listener to an object, and have it move down a specific number of pixels every frame (the more you have it move, the faster it'll move down--which would make it seem as though it has more gravity than other objects).

Hope that helps!

Modifying density can make an object float??, what can make an object so light that goes in opposite direction than gravity force?...

Are you looking for something like a balloon? If so, you could use apply force along with an enterframe listener. Just use negative number for the apply force in the y axis. Depending on your density and this force level you can make things counter gravity. Fun to toy around with.

Thx! is there an example of this somewhere? im a newbie in lua and Corona and this is the key for what im doing, an object that is constantly going up (bubble). Thx again!

Heh, I wanted it for the same reason. :) I ended up just setting gravity as a negative value, and applying forces for different speeds.

views:1565 update:2011/9/28 9:01:40
corona forums © 2003-2011