Hi!,
First of all I want to say Hi to all the box2d buddies around. This is my first post here 🙂.
I was a bit shocked when I saw there's no way to create a rigidbody in box2d without adding it to the physic world.
So, how do you ussually do this? I have seen in the sources that box2d uses a pool to avoid newing a lot. So, I have thought about caching b2BodyDef in my entities, and when I add a entity to the world (for example an enemy appears) do a world.createBody with this body definition. I need this because I use pools of entities pre-created to speed things up a bit and they use rigid bodies.
So? Could anybody give any piece of advice about this?. I Don't feel like adding all my entitiy bodies to the physic world and deactivating them until I really need :S.
Thanks in advance,
HexDump.
First of all I want to say Hi to all the box2d buddies around. This is my first post here 🙂.
I was a bit shocked when I saw there's no way to create a rigidbody in box2d without adding it to the physic world.
So, how do you ussually do this? I have seen in the sources that box2d uses a pool to avoid newing a lot. So, I have thought about caching b2BodyDef in my entities, and when I add a entity to the world (for example an enemy appears) do a world.createBody with this body definition. I need this because I use pools of entities pre-created to speed things up a bit and they use rigid bodies.
So? Could anybody give any piece of advice about this?. I Don't feel like adding all my entitiy bodies to the physic world and deactivating them until I really need :S.
Thanks in advance,
HexDump.