first of all thanks for this great library!
I'm currently developing a first-person-zombie-survival-shooter where I'm using bullet as physicsengine and I'm having problems with raycasting against the zombie-representations.
This is how I set up my btDiscreteDynamicsWorld:
1) I add the static rigid bodies of a Quake3-Map.
2) I create convex-hulls for the bones of my zombie-model.
3) For each currently living zombie I create a btCompoundShape with the convex-hulls of the bones as children and add that shape with a kinematic rigid body.
4) Each frame I'm synchronizing the bone-matrices of the model-instances with the btCompoundShapes of the physical zombie-representations over it's btDefaultMotionState.
5) If the player shoots, then I use the btDiscreteDynamicWorld's raytest-method to check if he has hit the zombie.
But for some reason if I aim and shoot at a zombie, the casted ray always ignores the rigid-bodies of the compound-shapes and goes straight for the static rigid-bodies of the map which are located behind the zombie.
This happens if I use kinematic or static rigidbodies for the zombies.
If I use dynamic rigid bodies the raycasting works, but the world-transformations of the bodies won't take rotation and scaling through calling the setFromGLMatrix()-method.
But that's no solution anyway, because if I use dynamic bodies, I get problems with my pathfinding- and crowd-management-library which can't handle external changes of the locations of it's agents very well.
If I debug-draw the btCompoundShapes of my zombies and the ray-direction everything looks fine.
I'm using the following code for raycasting:
Code: Select all
btCollisionWorld::ClosestRayResultCallback callback(start, end);
m_dynamicsWorld->rayTest(start, end, callback);
if (callback.hasHit()) ...
Thanks for your time!