i have built a test-scene with a btStaticPlaneShape and some boxes falling down from the sky.
all is fine - but if i increase the amount of boxes to over 1100 the application stops with a
seg.fault in function "dynamicsWorld->addRigidBody()".
here is the appropriate code:
Code: Select all
mCollShape = new btBoxShape( btVector3( width/2.0, height/2.0, depth/2.0 ) );
if( !mCollShape )
return false;
btMatrix3x3 mat;
mat.setEulerZYX( degToRad(mNode->getRotation().Z),
degToRad(mNode->getRotation().Y),
degToRad(mNode->getRotation().X) );
btDefaultMotionState* boxMotionState =
new btDefaultMotionState( btTransform( mat,btVector3( mNode->getPosition().X,
mNode->getPosition().Y, mNode->getPosition().Z ) ) );
if( !boxMotionState )
return false;
btVector3 inertia;
mCollShape->calculateLocalInertia( mass, inertia );
btConstructionInfo = new btRigidBody::btRigidBodyConstructionInfo( mass, boxMotionState, mCollShape, inertia);
if( !btConstructionInfo )
return false;
btBody = new btRigidBody( *btConstructionInfo );
if( btBody )
Physics::getPhysics()->dynamicsWorld->addRigidBody( btBody );