Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
117 views
in Technique[技术] by (71.8m points)

c++ - How to use PxOverlapCallback in NVIDA Physx for overlap queries

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...