Question

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?

Était-ce utile?

La solution

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

   sta2def.gravityScale = 0.0f;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top