本文整理汇总了C++中PxScene::overlapMultiple方法的典型用法代码示例。如果您正苦于以下问题:C++ PxScene::overlapMultiple方法的具体用法?C++ PxScene::overlapMultiple怎么用?C++ PxScene::overlapMultiple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxScene
的用法示例。
在下文中一共展示了PxScene::overlapMultiple方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tryStandup
void ControlledActor::tryStandup()
{
// overlap with upper part
if(mType==PxControllerShapeType::eBOX)
{
}
else if(mType==PxControllerShapeType::eCAPSULE)
{
PxCapsuleController* capsuleCtrl = static_cast<PxCapsuleController*>(mController);
PxReal r = capsuleCtrl->getRadius();
PxReal dh = mStandingSize - mCrouchingSize-2*r;
PxCapsuleGeometry geom(r, dh*.5f);
PxExtendedVec3 position = mController->getPosition();
PxVec3 pos((float)position.x,(float)position.y+mStandingSize*.5f+r,(float)position.z);
PxQuat orientation(PxHalfPi, PxVec3(0.0f, 0.0f, 1.0f));
PxShape* hit;
PxScene* scene = mController->getScene();
if(scene->overlapMultiple(geom, PxTransform(pos,orientation),&hit,1) != 0) return;
}
// if no hit, we can stand up
resizeStanding();
mDoStandup = false;
mIsCrouching = false;
}
示例2: findTouchedGeometry
void Cct::findTouchedGeometry(
const InternalCBData_FindTouchedGeom* userData,
const PxExtendedBounds3& worldBounds, // ### we should also accept other volumes
TriArray& worldTriangles,
IntArray& triIndicesArray,
IntArray& geomStream,
const CCTFilter& filter,
const CCTParams& params)
{
PX_ASSERT(userData);
const PxInternalCBData_FindTouchedGeom* internalData = static_cast<const PxInternalCBData_FindTouchedGeom*>(userData);
PxScene* scene = internalData->scene;
Cm::RenderBuffer* renderBuffer = internalData->renderBuffer;
PxExtendedVec3 Origin; // Will be TouchedGeom::mOffset
getCenter(worldBounds, Origin);
// Find touched *boxes* i.e. touched objects' AABBs in the world
// We collide against dynamic shapes too, to get back dynamic boxes/etc
// TODO: add active groups in interface!
PxSceneQueryFilterFlags sqFilterFlags;
if(filter.mStaticShapes) sqFilterFlags |= PxSceneQueryFilterFlag::eSTATIC;
if(filter.mDynamicShapes) sqFilterFlags |= PxSceneQueryFilterFlag::eDYNAMIC;
if(filter.mFilterCallback)
{
if(filter.mPreFilter)
sqFilterFlags |= PxSceneQueryFilterFlag::ePREFILTER;
if(filter.mPostFilter)
sqFilterFlags |= PxSceneQueryFilterFlag::ePOSTFILTER;
}
// ### this one is dangerous
const PxBounds3 tmpBounds(toVec3(worldBounds.minimum), toVec3(worldBounds.maximum)); // LOSS OF ACCURACY
// PT: unfortunate conversion forced by the PxGeometry API
PxVec3 center = tmpBounds.getCenter(), extents = tmpBounds.getExtents();
PxShape* hits[100];
PxU32 size = 100;
const PxSceneQueryFilterData sceneQueryFilterData = filter.mFilterData ? PxSceneQueryFilterData(*filter.mFilterData, sqFilterFlags) : PxSceneQueryFilterData(sqFilterFlags);
PxI32 numberHits = scene->overlapMultiple(PxBoxGeometry(extents), PxTransform(center), hits, size, sceneQueryFilterData, filter.mFilterCallback);
for(PxI32 i = 0; i < numberHits; i++)
{
PxShape* shape = hits[i];
if(shape == NULL)
continue;
// Filtering
// Discard all CCT shapes, i.e. kinematic actors we created ourselves. We don't need to collide with them since they're surrounded
// by the real CCT volume - and collisions with those are handled elsewhere. We use the userData field for filtering because that's
// really our only valid option (filtering groups are already used by clients and we don't have control over them, clients might
// create other kinematic actors that we may want to keep here, etc, etc)
if(internalData->cctShapeHashSet->contains(shape))
continue;
// Ubi (EA) : Discarding Triggers :
if(shape->getFlags() & PxShapeFlag::eTRIGGER_SHAPE)
continue;
// PT: here you might want to disable kinematic objects.
// Output shape to stream
const PxTransform globalPose = getShapeGlobalPose(*shape);
const PxGeometryType::Enum type = shape->getGeometryType(); // ### VIRTUAL!
if(type==PxGeometryType::eSPHERE) outputSphereToStream(shape, globalPose, geomStream, Origin);
else if(type==PxGeometryType::eCAPSULE) outputCapsuleToStream(shape, globalPose, geomStream, Origin);
else if(type==PxGeometryType::eBOX) outputBoxToStream(shape, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer);
else if(type==PxGeometryType::eTRIANGLEMESH) outputMeshToStream(shape, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer);
else if(type==PxGeometryType::eHEIGHTFIELD) outputHeightFieldToStream(shape, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer);
else if(type==PxGeometryType::eCONVEXMESH) outputConvexToStream(shape, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds);
else if(type==PxGeometryType::ePLANE) outputPlaneToStream(shape, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer);
}
}