0
votes

I have set the gravity of my world as follows

world=new b2World(b2Vec2(0.0,9.8));

I have a dynamic body called b2Body* sta1 which is falling from the top of the screen. And I have another dynamic body sta2 which should not fall i.e it just move on some keypress. The problem is how can I give this body of my world zero gravity i.e is there any way to give different gravity values to different bodies in the world?

1
You again :) Do you ever use google? iforce2d.net/b2dtut/custom-gravityiforce2d
aah thats embarassing! I need to learn how to google stuff!!Vector
Okay so I need to do this: bodydef.gravityScale = 0.0f; Am i right?Vector
well... if it worked, then you are right.iforce2d

1 Answers

1
votes

yes you are right. You should set the gravity scale of the body defition.

   sta2def.gravityScale = 0.0f;