I'm making a racer game. Some strange problem appears: when the size of ground ( I tried both btConvexShape and btBoxShape as shapes for the ground) is small (100x100, for example), vehicle normally behaves. But when size becomes big (~1000x1000) wheels begin vibrating. I found the problem in rayCast precision. btDynamicWorld's rayCast becomes too unstable returning values in wide range while small variations of ray start position are given.
Bullet initialization:
Code: Select all
collision_conf = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collision_conf);
broadphase = new btDbvtBroadphase(new btHashedOverlappingPairCache());
solver = new btSequentialImpulseConstraintSolver();
world = static_cast<btDynamicsWorld*> (new btDiscreteDynamicsWorld (dispatcher, broadphase, solver, collision_conf));
world->setGravity(btVector3(0,-9.8,0));
btVector3 localInertia (0,0,0);
btCollisionShape* groundShape = new btBoxShape(btVector3(1200,3,1200)); // <--- I played with ground size here
btRigidBody* ground = new btRigidBody(0,0,groundShape,localInertia);
ground->setWorldTransform(btTransform(btQuaternion(0,0,0,1), btVector3(0,-5,0)));
world->addRigidBody(ground);
Are there any ideas?