I’m trying to use Physx to perform an overlap query on my scene, but am having trouble based off of the documentation. I am following the information here: Scene Queries — NVIDIA PhysX SDK 4.1 Documentation
Based off of the example in the SDK Guide, I created my own callback class, inheriting from PxOverlapCallback:
struct OverlapCallback : physx::PxOverlapCallback {
OverlapCallback(userData* userData) : physx::PxOverlapCallback(NULL, 0) {
mUserData = userData;
}
physx::PxAgain processTouches(const physx::PxOverlapHit* buffer, physx::PxU32 nbHits) {
std::cout << "Number of overlap hits: " << nbHits << std::endl;
return true;
}
void finalizeQuery() {
std::cout << "Finalizing query" << std::endl;
}
userData* mUserData;
};
However, if I utilize this callback function, I get an error from Physx:
physxsrc53e20a06fa-b4a222d4bd.cleanphysxsourcephysxsrcNpSceneQueries.cpp (709) : invalid parameter : PxScene::overlap() and PxBatchQuery::overlap() calls without eANY_HIT flag require a touch hit buffer for return results.
But isn’t the point of using the callback that I don’t need a buffer? The default flag for overlap queries should be eNO_HIT, so I’m not sure why I’m getting this error.
thanks in advance for any pointers or help you can provide!
question from:
https://stackoverflow.com/questions/65910034/how-to-use-pxoverlapcallback-in-nvida-physx-for-overlap-queries 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…