| 2442 | } |
| 2443 | |
| 2444 | PxRigidDynamic* PhysXSample::createTestCompound(const PxVec3& pos, PxU32 nbBoxes, float boxSize, float amplitude, const PxVec3* vel, RenderMaterial* material, PxReal density, bool makeSureVolumeEmpty) |
| 2445 | { |
| 2446 | PxSceneWriteLock scopedLock(*mScene); |
| 2447 | if (makeSureVolumeEmpty) |
| 2448 | { |
| 2449 | // Kai: a little bigger than amplitude + boxSize * sqrt(3) |
| 2450 | PxSphereGeometry geometry(amplitude + boxSize + boxSize); |
| 2451 | PxTransform pose(pos); |
| 2452 | PxOverlapBuffer buf; |
| 2453 | getActiveScene().overlap(geometry, pose, buf, |
| 2454 | PxQueryFilterData(PxQueryFlag::eANY_HIT|PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC)); |
| 2455 | if (buf.hasBlock) { |
| 2456 | // shdfnd::printFormatted("desination volume is not empty!!!\n"); |
| 2457 | return NULL; |
| 2458 | } |
| 2459 | } |
| 2460 | |
| 2461 | std::vector<PxTransform> localPoses; |
| 2462 | std::vector<const PxGeometry*> geometries; |
| 2463 | |
| 2464 | PxToolkit::BasicRandom rnd(42); |
| 2465 | |
| 2466 | PxBoxGeometryAlloc* geoms = SAMPLE_NEW(PxBoxGeometryAlloc)[nbBoxes]; |
| 2467 | |
| 2468 | for(PxU32 i=0;i<nbBoxes;i++) |
| 2469 | { |
| 2470 | geoms[i].halfExtents = PxVec3(boxSize); |
| 2471 | |
| 2472 | PxTransform localPose; |
| 2473 | rnd.unitRandomPt(localPose.p); |
| 2474 | localPose.p.normalize(); |
| 2475 | localPose.p *= amplitude; |
| 2476 | rnd.unitRandomQuat(localPose.q); |
| 2477 | |
| 2478 | localPoses.push_back(localPose); |
| 2479 | geometries.push_back(&geoms[i]); |
| 2480 | } |
| 2481 | PxRigidDynamic* actor = createCompound(pos, localPoses, geometries, vel, material, density); |
| 2482 | DELETEARRAY(geoms); |
| 2483 | return actor; |
| 2484 | } |
| 2485 | |
| 2486 | /////////////////////////////////////////////////////////////////////////////// |
| 2487 |
nothing calls this directly
no test coverage detected