Physics Body not effected by gravity

Is there a way to make physics body, but not effected by gravity?
Thanks

you must be new based on your question, no worries

first (i'm sure you got this) add the physics

local physics = require( "physics" )
physics.start()

then set the gravity

physics.setGravity( 0, 9.8 )

your question answer is simple, if you make you body a "static" object then it will stay and place but still be effected by collision and act like a "ground" or a "border.

here is a simple "static" setting addBody "function"

physics.addBody( ground, "static", { friction=0.5, bounce=0.3 } )

that should answer your question

also refer to the sample app under physics labeled "hello physics"

-boxie

Thanks. Static won't help me here because I have that object rotating at all the time.
Is there any other solution?
Thanks

You could make it "kinematic", its like static but it's not effected by gravity. I think that's what your looking for ;)

If you want to see it in action here you go :

1
2
3
4
5
6
local physics = require( "physics" )
physics.start()
 
physics.setGravity( 0, 9.8 )
 
physics.addBody(objectName,"kinematic")

Static can still rotate if you felt like using obj.rotation rather than applying force or the like. (Just one option.)

Peach :)

views:2611 update:2012/2/13 9:11:28
corona forums © 2003-2011