First of all: I am new to this. But it would be amazing if guys could help me out.
I am creating a lot of cubes (>7000). Each frame an update method is called where a cube is created and a rigidBody is added to the cube. After around 200 cubes the bodies, rigidbodies stop being created. Also FPS is decreasing rapidly.
Is there a specific method on how to create multiple instances of rigidBodies?
create cube in physics world:
Code: Select all
btRigidBody* Physics::createCube(float edge_length, float px, float py, float pz, float mass)
{
//ref:http://stackoverflow.com/questions/9117932/detecting-collisions-with-bullet
btCollisionShape* colShape = new btBoxShape(btVector3(edge_length, edge_length, edge_length));
return Physics::addCollisionShape(colShape, px, py, pz, mass);
}