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?

有帮助吗?

解决方案

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

   sta2def.gravityScale = 0.0f;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top