When I made my demo, there was such a problem: the character jumped up, how did I determine when it was implemented, and the problem of landing? I didn't find the relevant solution in ogrebullet, I can only use the bullet collision callback function here. The following is my practice. If there is any better method, please let me know. Thank you here.
// OgreBulletDynamics: DynamicsWorld * mWorld;
// MyInternalTickCallback is a callback function typedef void (* btInternalTickCallback) (btDynamicsWorld * world, btScalar timeStep );
MWorld-> getBulletDynamicsWorld ()-> setInternalTickCallback (myInternalTickCallback );
Void myInternalTickCallback (btDynamicsWorld * world, btScalar timeStep)
{
// Obtain the collision pair, that is, the collision of two objects produces a collision pair.
Int numManifolds = world-> getDispatcher ()-> getNumManifolds ();
For (int I = 0; I <numManifolds; I ++)
{
// Obtain index I and other collision pairs
BtPersistentManifold * contactManifold = world-> getDispatcher ()-> getManifoldByIndexInternal (I );
// Obtain the collision objects in the Collision Center
BtCollisionObject * obA = static_cast <btCollisionObject *> (contactManifold-> getBody0 ());
BtCollisionObject * obB = static_cast <btCollisionObject *> (contactManifold-> getBody1 ());
Int numContacts = contactManifold-> getNumContacts (); // multiple collision points may exist.
// Obtain the information set by the user to the collision object.
// You can add
// Std: string * rname = new std: string ("StaticTrimeshtest ");
// RigidStaticBody-> getBulletRigidBody ()-> setUserPointer (rname );
Std: string * s1 = static_cast <std: string *> (obA-> getUserPointer ());
Std: string * s2 = static_cast <std: string *> (obB-> getUserPointer ());
// Check whether s1 and s2 are the information we need. Note that if an object does not set user information, s1 or s2
// It will be a null pointer.
If (numContacts> 0 & s1 & s2)
{
// You can make a judgment here.
}
}
}