I'm completely new to Bullet and I'm trying to accomplish some task in it, which as its part has horizontal movement of one object on top of another. I created little example, where I first let fall small box
Code: Select all
btTransform Transform2;
Transform2.setIdentity();
btVector3 position = btVector3(0,10,0);
Transform2.setOrigin(position);
btDefaultMotionState *MS2 = new btDefaultMotionState(Transform2);
btCollisionShape *CS2 = new btBoxShape(btVector3(0.5,0.5,0.5));
btVector3 LocalInertia2;
CS2->calculateLocalInertia(1,LocalInertia2);
btRigidBody *RB2 = new btRigidBody(1, MS2, CS2, LocalInertia2);
Code: Select all
btTransform Transform1;
Transform1.setIdentity();
Transform1.setOrigin(btVector3(0,0,0));
btDefaultMotionState *MS1 = new btDefaultMotionState(Transform1);
btCollisionShape *CS1 = new btBoxShape(btVector3(5,0.5,5));
btVector3 LocalInertia1;
CS1->calculateLocalInertia(1.0,LocalInertia1);
btRigidBody* RB1 = new btRigidBody(0, MS1, CS1, LocalInertia1);
Code: Select all
if(currTime - origTime > 3000 && !bForced)
{
RB2->applyCentralImpulse(btVector3(0.1f,0,0.1f));
bForced = true;
}
Is there any way how to make the platform solid (as a stone), so the box doesn't sink into it?
The Bullet world I'm using is initialized as follows
Code: Select all
btDefaultCollisionConfiguration *CollisionConfiguration = new btDefaultCollisionConfiguration();
btBroadphaseInterface *BroadPhase = new btAxisSweep3(btVector3(-1000, -1000, -1000), btVector3(1000, 1000, 1000));
btCollisionDispatcher *Dispatcher = new btCollisionDispatcher(CollisionConfiguration);
btSequentialImpulseConstraintSolver *Solver = new btSequentialImpulseConstraintSolver();
btDiscreteDynamicsWorld *World = new btDiscreteDynamicsWorld(Dispatcher, BroadPhase, Solver, CollisionConfiguration);