I am new to bullet. Have a bunch of objects in the simulation (using Ogre) that needs to collide with each other.
I will take control of one of these objects and drive it via Mouse and keyboard and make them collide with other
objects in the simulation. I can then change the selected object to another one in the scene at runtime by pressing
a keyboard key ("space").
I ahve all the objects loaded in the simulation the start in the air and fall to the ground. I see the effect of collision between the floor and the objects. Also between two objects on the fall (There is no user control activated here yet). Below is the code i use to setup the rigid body objects.
Code: Select all
_cprintf("-> Creating Physics model %s.\n",(*p)->ObjectName.c_str());
BtOgre::StaticMeshToShapeConverter converter(MyEntity);
(*p)->mObjShape = converter.createBox();
(*p)->mObjShape->setLocalScaling(btVector3((*p)->AxisScaling[0],(*p)->AxisScaling[1],(*p)->AxisScaling[2]));
//Calculate inertia.
btScalar mass = 2;
btVector3 inertia;
(*p)->mObjShape->calculateLocalInertia(mass, inertia);
//Create BtOgre MotionState (connects Ogre and Bullet).
(*p)->mObjState = new BtOgre::RigidBodyState((*p)->mObjNode);
Code: Select all
ActiveToolName = ObjArray.GetObjectFromList(ActiveToolToggle);
ObjectPtr ObjData = ObjArray.GetObjectPtrGivenIndx(ActiveToolToggle);
ObjData->mObjBody->setCollisionFlags(ObjData->mObjBody->getCollisionFlags() | CollisionObject::CF_KINEMATIC_OBJECT);
Code: Select all
ObjData->mObjBody->setWorldTransform(btTransform(btQuaternion(Ori.x,Ori.y,Ori.z,Ori.w),btVector3(cPos.x,cPos.y,cPos.z)));
It seems that the controlled pobject does not collide with the other objects in the scene and cause any physic effects. They just passthrough them!!! What am i doing wrong to enable a CONTROLLED object that can create physics effects at runtime with other righidbodies in the Simulation.
Here are two pictures i captures from the debugdrawer in bullet/Ogre.
The first picture shows the initial configuration of the sim.
The second picture shows after i have moved the selected objects they are now in collision with each other there should be physics motion of the other objects the ball and the pick.
Any help you can provide woult be greatful. am lost i just need a hint of sorts to proceed. A example code would be great.
Garibalde