Domanda

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?

È stato utile?

Soluzione

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

   sta2def.gravityScale = 0.0f;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top