Sorry for the undescriptive title, couldn't really describe it in one sentence.
I'm having a lot of trouble with physx and to be honest, the documentation is rather lacking.
I've tried to ask on the official forums, but they're more or less a ghost town.
I'm currently having 3 problems I can't find a solution for:
1) PxScene::overlap always returns true
According to the documentation, it's supposed to return 'True if a blocking hit was found or any hit was found in case PxQueryFlag::eANY_HIT flag was specified.'.
In my trials it always returned true, whether there was an overlap or not:
physx::PxCapsuleController *controller = static_cast<physx::PxCapsuleController*>(physController->GetController());
physx::PxScene *scene = controller->getScene();
physx::PxSceneReadLock scopedLock(*scene);
physx::PxCapsuleGeometry geom(1,1); // Radius and height = 1, just for testing
physx::PxVec3 pos(0,0,0);
physx::PxQuat orientation(physx::PxHalfPi,physx::PxVec3(0.0f,0.0f,1.0f));
physx::PxOverlapBuffer hit;
if(scene->overlap(geom,physx::PxTransform(pos,orientation),hit,physx::PxQueryFilterData(physx::PxQueryFlag::eANY_HIT)));
{
Con::cerr<<"getNbAnyHits: "<<hit.getNbAnyHits()<<Con::endl;
Con::cerr<<"getNbTouches: "<<hit.getNbTouches()<<Con::endl;
Con::cerr<<"hasBlock: "<<hit.hasBlock<<Con::endl;
return false;
}
This creates a tiny capsule at the origin, there's no way there could be a collision with anything, yet the output is this:
getNbAnyHits: 0
getNbTouches: 0
hasBlock: 0
Why does it return true if it hasn't found anything blocking it? Am I missing something?
This is the scene as shown through the PVD:
http://i.imgur.com/in6hnse.jpg
If there IS a collision, it still returns true, but hasBlock is != 0.
2) PxControllers collide prematurely
Both PxBoxController and PxCapsuleController objects collide with my static world before they actually touch it:
http://filesmelt.com/dl/physxcontactoff.jpg
(The capsule was getting pushed down by gravity and towards the wall, but stopped at the position shown here)
PxRigidDynamic objects collide with the world as they should.
At first I thought this has something to do with the contact offset, but I've tried setting that to 0, or a value very close to 0, and it made no difference.
3) Pushing PxControllers
I'd like to implement a simple jump functionality for a playable character (PxCapsuleController).
Problem is, PxController objects 'stick' to the world until they receive a certain force. So if my character is currently standing on solid ground, and is getting pushed upwards by a small force, he will stick to the ground and not move at all.
How can I disable this for a controller temporarily?
Thanks in advance.