MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / sweep

Method sweep

physx/source/physx/src/NpBatchQuery.cpp:513–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511}
512
513void NpBatchQuery::sweep(
514 const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, PxU16 maxTouchHits,
515 PxHitFlags hitFlags, const PxQueryFilterData& fd, void* userData, const PxQueryCache* cache, const PxReal inflation)
516{
517 PX_CHECK_AND_RETURN(pose.isValid(), "Batch sweep input check: pose is not valid.");
518 PX_CHECK_AND_RETURN(unitDir.isFinite(), "Batch sweep input check: unitDir is not valid.");
519 PX_CHECK_AND_RETURN(unitDir.isNormalized(), "Batch sweep input check: direction must be normalized");
520 PX_CHECK_AND_RETURN(distance >= 0.0f, "Batch sweep input check: distance cannot be negative");
521 PX_CHECK_AND_RETURN(distance != 0.0f || !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP),
522 "Batch sweep input check: zero-length sweep only valid without the PxHitFlag::eASSUME_NO_INITIAL_OVERLAP flag");
523
524#if PX_CHECKED
525 if(!PxGeometryQuery::isValid(geometry))
526 {
527 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Provided geometry is not valid");
528 return;
529 }
530#endif // PX_CHECKED
531
532 if (mNbSweeps >= mDesc.queryMemory.getMaxSweepsPerExecute())
533 {
534 PX_CHECK_AND_RETURN(mNbSweeps < mDesc.queryMemory.getMaxSweepsPerExecute(),
535 "PxBatchQuery: number of sweep() calls exceeds PxBatchQueryMemory::sweepResultBufferSize, query discarded");
536 return;
537 }
538
539
540 CHECK_RUNNING("PxBatchQuery::sweep: This batch is still executing, skipping query.")
541 mNbSweeps++;
542
543 writeBatchHeader(BatchStreamHeader(hitFlags, cache, fd, userData, maxTouchHits, QTypeROS::eSWEEP));
544
545 //set the MTD flag
546 mHasMtdSweep |= !!(hitFlags & PxHitFlag::eMTD);
547
548 if((hitFlags & PxHitFlag::ePRECISE_SWEEP) && (hitFlags & PxHitFlag::eMTD))
549 {
550 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, " Precise sweep doesn't support MTD. Perform MTD with default sweep");
551 hitFlags &= ~PxHitFlag::ePRECISE_SWEEP;
552 }
553
554 if((hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP) && (hitFlags & PxHitFlag::eMTD))
555 {
556 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, " eMTD cannot be used in conjunction with eASSUME_NO_INITIAL_OVERLAP. eASSUME_NO_INITIAL_OVERLAP will be ignored");
557 hitFlags &= ~PxHitFlag::eASSUME_NO_INITIAL_OVERLAP;
558 }
559
560 PxReal realInflation = inflation;
561 if((hitFlags & PxHitFlag::ePRECISE_SWEEP)&& inflation > 0.0f)
562 {
563 realInflation = 0.0f;
564 Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, " Precise sweep doesn't support inflation, inflation will be overwritten to be zero");
565 }
566
567 writeQueryInput(mStream, MultiQueryInput(&geometry, &pose, unitDir, distance, realInflation));
568
569 Ps::atomicExchange(&mBatchQueryIsRunning, 0);
570}

Callers 8

readyToSyncCCTMethod · 0.45
linearSweepSingleMethod · 0.45
linearSweepMultipleMethod · 0.45
sweepAnyMethod · 0.45
sweepSingleMethod · 0.45
sweepMultipleMethod · 0.45
scanForObstaclesMethod · 0.45

Calls 9

writeQueryInputFunction · 0.85
MultiQueryInputClass · 0.85
errorMethod · 0.80
BatchStreamHeaderClass · 0.70
isValidFunction · 0.50
atomicExchangeFunction · 0.50
isValidMethod · 0.45
isFiniteMethod · 0.45
isNormalizedMethod · 0.45

Tested by

no test coverage detected