本文整理汇总了C++中PxRigidActor::getScene方法的典型用法代码示例。如果您正苦于以下问题:C++ PxRigidActor::getScene方法的具体用法?C++ PxRigidActor::getScene怎么用?C++ PxRigidActor::getScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxRigidActor
的用法示例。
在下文中一共展示了PxRigidActor::getScene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComponentSweepMulti
bool UWorld::ComponentSweepMulti(TArray<struct FHitResult>& OutHits, class UPrimitiveComponent* PrimComp, const FVector& Start, const FVector& End, const FRotator& Rot, const struct FComponentQueryParams& Params) const
{
if(GetPhysicsScene() == NULL)
{
return false;
}
if(PrimComp == NULL)
{
UE_LOG(LogCollision, Log, TEXT("ComponentSweepMulti : No PrimComp"));
return false;
}
// if target is skeletalmeshcomponent and do not support singlebody physics
if ( !PrimComp->ShouldTrackOverlaps() )
{
UE_LOG(LogCollision, Log, TEXT("ComponentSweepMulti : (%s) Does not support skeletalmesh with Physics Asset and destructibles."), *PrimComp->GetPathName());
return false;
}
ECollisionChannel TraceChannel = PrimComp->GetCollisionObjectType();
#if WITH_PHYSX
// if extent is 0, do line trace
if (PrimComp->IsZeroExtent())
{
return RaycastMulti(this, OutHits, Start, End, TraceChannel, Params, FCollisionResponseParams(PrimComp->GetCollisionResponseToChannels()));
}
PxRigidActor* PRigidActor = PrimComp->BodyInstance.GetPxRigidActor();
if(PRigidActor == NULL)
{
UE_LOG(LogCollision, Log, TEXT("ComponentSweepMulti : (%s) No physics data"), *PrimComp->GetPathName());
return false;
}
PxScene * const PScene = PRigidActor->getScene();
OutHits.Empty();
// Get all the shapes from the actor
TArray<PxShape*, TInlineAllocator<8>> PShapes;
{
SCOPED_SCENE_READ_LOCK(PScene);
PShapes.AddZeroed(PRigidActor->getNbShapes());
PRigidActor->getShapes(PShapes.GetData(), PShapes.Num());
}
// calculate the test global pose of the actor
PxTransform PGlobalStartPose = U2PTransform(FTransform(Start));
PxTransform PGlobalEndPose = U2PTransform(FTransform(End));
bool bHaveBlockingHit = false;
PxQuat PGeomRot = U2PQuat(Rot.Quaternion());
// Iterate over each shape
SCENE_LOCK_READ(PScene);
for(int32 ShapeIdx=0; ShapeIdx<PShapes.Num(); ShapeIdx++)
{
PxShape* PShape = PShapes[ShapeIdx];
check(PShape);
TArray<struct FHitResult> Hits;
// Calc shape global pose
PxTransform PLocalShape = PShape->getLocalPose();
PxTransform PShapeGlobalStartPose = PGlobalStartPose.transform(PLocalShape);
PxTransform PShapeGlobalEndPose = PGlobalEndPose.transform(PLocalShape);
// consider localshape rotation for shape rotation
PxQuat PShapeRot = PGeomRot * PLocalShape.q;
GET_GEOMETRY_FROM_SHAPE(PGeom, PShape);
if(PGeom != NULL)
{
SCENE_UNLOCK_READ(PScene);
if (GeomSweepMulti(this, *PGeom, PShapeRot, Hits, P2UVector(PShapeGlobalStartPose.p), P2UVector(PShapeGlobalEndPose.p), TraceChannel, Params, FCollisionResponseParams(PrimComp->GetCollisionResponseToChannels())))
{
bHaveBlockingHit = true;
}
OutHits.Append(Hits);
SCENE_LOCK_READ(PScene);
}
}
SCENE_UNLOCK_READ(PScene);
return bHaveBlockingHit;
#endif //WITH_PHYSX
return false;
}