Hello,
I am currently porting C++ code from using PhysX SDK 2.8.4 to using PhysX SDK 3.2.1 (PC Win32), and I’m having trouble with batched raycasts.
Here is the simple structure of the old code:
NxSceneQueryDesc desc;
desc.report = mReport;
desc.executeMode = NX_SQE_ASYNCHRONOUS; // Asynchronous mode.
NxSceneQuery* batch = mScene->createSceneQuery(desc);
batch->raycastAnyShape(/* params (1) */);
batch->raycastAnyShape(/* params (2) */);
batch->raycastClosestShape(/* params (3) */);
// ...
batch->execute(); // Non-blocking call, returns immediately.
foo(); // Do other work
bar(); // while raycasts are being
baz(); // executed in parallel.
batch->finish(true); // Blocking call (until all queries have been executed).
Indeed, in the docs we had (emphasis mine):
But now in PhysX 3 (where NxSceneQuery has been renamed PxBatchQuery), there is no “PxBatchQueryExecuteMode” nor “PxBatchQuery::finish()” anymore, and it seems that calls to PxBatchQuery::execute() are always blocking.
So here’s my question: How can I get the same old behavior (have batched queries execute asynchronously in a background thread) in PhysX 3.2?
Do I have to inherit a class from pxtask::Task and override run() to call PxBatchQuery::execute() inside or something? (I’m not familiar with the new Task Management system…)
Thank you very much.