Remove gravity from single body

Posted by Siddharth on Game Development See other posts from Game Development or by Siddharth
Published on 2012-05-24T13:35:44Z Indexed on 2012/12/10 17:32 UTC
Read the original article Hit count: 299

Filed under:
|

I have multiple bodies in my game world in andengine. All the bodies affected by gravity but in that I want my specific body does not affected by the gravity.

For that solution after research I found that I have to use body.setGravityScale(0) method for my problem solution.

But in my andengine extension I don't found that method so please provide guidance about how get access about that method.

Also for the above problem any other guidance will be acceptable. Thank You!

I apply following code for reverse gravity final Vector2 vec = new Vector2(0, -SensorManager.GRAVITY_EARTH * bulletBody.getMass());

bulletBody.applyForce(vec, bulletBody.getWorldCenter());

© Game Development or respective owner

Related posts about box2d

Related posts about andengine