Allow A Object To Not obey Gravity

I want all my objects but one to be affected by gravity. Is there a way to void it out for a certain object?

You can set bodyType to "static" or "kinematic".

http://developer.anscamobile.com/reference/index/bodybodytype

Or you can just not add a physics body to it.

The problem with that is that if you make one object kinematic or static, you run into problems with the object not colliding with other objects anymore.

For example, if you have a bunch of static objects that define the walls or terrain in a game, and you want your flying object to not respond to gravity, and you set it as kinematic, it'll pass through the terrain.

It's not impossible to solve the problem, but it requires a lot of extra work compared to if you could just have a "respondsToGravity=false" flag...

An alternate solution would be to keep things dynamic, but turn off gravity and simulate gravity by adding a force in each enterFrame

good luck!

views:1512 update:2011/10/5 21:23:48
corona forums © 2003-2011