本文整理汇总了C++中PxVec3::minElement方法的典型用法代码示例。如果您正苦于以下问题:C++ PxVec3::minElement方法的具体用法?C++ PxVec3::minElement怎么用?C++ PxVec3::minElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PxVec3
的用法示例。
在下文中一共展示了PxVec3::minElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddConvexElemsToRigidActor
void UBodySetup::AddConvexElemsToRigidActor(PxRigidActor* PDestActor, const FTransform& RelativeTM, const FVector& Scale3D, const FVector& Scale3DAbs, TArray<PxShape*>* NewShapes) const
{
float ContactOffsetFactor, MaxContactOffset;
GetContactOffsetParams(ContactOffsetFactor, MaxContactOffset);
PxMaterial* PDefaultMat = GetDefaultPhysMaterial();
for (int32 i = 0; i < AggGeom.ConvexElems.Num(); i++)
{
const FKConvexElem& ConvexElem = AggGeom.ConvexElems[i];
if (ConvexElem.ConvexMesh)
{
PxTransform PLocalPose;
bool bUseNegX = CalcMeshNegScaleCompensation(Scale3D, PLocalPose);
PxConvexMeshGeometry PConvexGeom;
PConvexGeom.convexMesh = bUseNegX ? ConvexElem.ConvexMeshNegX : ConvexElem.ConvexMesh;
PConvexGeom.scale.scale = U2PVector(Scale3DAbs * ConvexElem.GetTransform().GetScale3D().GetAbs());
FTransform ConvexTransform = ConvexElem.GetTransform();
if (ConvexTransform.GetScale3D().X < 0 || ConvexTransform.GetScale3D().Y < 0 || ConvexTransform.GetScale3D().Z < 0)
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: [%s] ConvexElem[%d] has negative scale. Not currently supported"), *GetPathNameSafe(GetOuter()), i);
}
if (ConvexTransform.IsValid())
{
PxTransform PElementTransform = U2PTransform(ConvexTransform * RelativeTM);
PLocalPose.q *= PElementTransform.q;
PLocalPose.p = PElementTransform.p;
PLocalPose.p.x *= Scale3D.X;
PLocalPose.p.y *= Scale3D.Y;
PLocalPose.p.z *= Scale3D.Z;
if (PConvexGeom.isValid())
{
PxVec3 PBoundsExtents = PConvexGeom.convexMesh->getLocalBounds().getExtents();
ensure(PLocalPose.isValid());
PxShape* NewShape = PDestActor->createShape(PConvexGeom, *PDefaultMat, PLocalPose);
if (NewShapes)
{
NewShapes->Add(NewShape);
}
const float ContactOffset = FMath::Min(MaxContactOffset, ContactOffsetFactor * PBoundsExtents.minElement());
NewShape->setContactOffset(ContactOffset);
}
else
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: [%s] ConvexElem[%d] invalid"), *GetPathNameSafe(GetOuter()), i);
}
}
else
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: [%s] ConvexElem[%d] has invalid transform"), *GetPathNameSafe(GetOuter()), i);
}
}
else
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: ConvexElem is missing ConvexMesh (%d: %s)"), i, *GetPathName());
}
}
}
示例2: AddConvexElemsToRigidActor_AssumesLocked
void AddConvexElemsToRigidActor_AssumesLocked() const
{
float ContactOffsetFactor, MaxContactOffset;
GetContactOffsetParams(ContactOffsetFactor, MaxContactOffset);
for (int32 i = 0; i < BodySetup->AggGeom.ConvexElems.Num(); i++)
{
const FKConvexElem& ConvexElem = BodySetup->AggGeom.ConvexElems[i];
if (ConvexElem.ConvexMesh)
{
PxTransform PLocalPose;
bool bUseNegX = CalcMeshNegScaleCompensation(Scale3D, PLocalPose);
PxConvexMeshGeometry PConvexGeom;
PConvexGeom.convexMesh = bUseNegX ? ConvexElem.ConvexMeshNegX : ConvexElem.ConvexMesh;
PConvexGeom.scale.scale = U2PVector(Scale3DAbs * ConvexElem.GetTransform().GetScale3D().GetAbs());
FTransform ConvexTransform = ConvexElem.GetTransform();
if (ConvexTransform.GetScale3D().X < 0 || ConvexTransform.GetScale3D().Y < 0 || ConvexTransform.GetScale3D().Z < 0)
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: [%s] ConvexElem[%d] has negative scale. Not currently supported"), *GetPathNameSafe(BodySetup->GetOuter()), i);
}
if (ConvexTransform.IsValid())
{
PxTransform PElementTransform = U2PTransform(ConvexTransform * RelativeTM);
PLocalPose.q *= PElementTransform.q;
PLocalPose.p = PElementTransform.p;
PLocalPose.p.x *= Scale3D.X;
PLocalPose.p.y *= Scale3D.Y;
PLocalPose.p.z *= Scale3D.Z;
if (PConvexGeom.isValid())
{
PxVec3 PBoundsExtents = PConvexGeom.convexMesh->getLocalBounds().getExtents();
ensure(PLocalPose.isValid());
{
const float ContactOffset = FMath::Min(MaxContactOffset, ContactOffsetFactor * PBoundsExtents.minElement());
AttachShape_AssumesLocked(PConvexGeom, PLocalPose, ContactOffset);
}
}
else
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: [%s] ConvexElem[%d] invalid"), *GetPathNameSafe(BodySetup->GetOuter()), i);
}
}
else
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: [%s] ConvexElem[%d] has invalid transform"), *GetPathNameSafe(BodySetup->GetOuter()), i);
}
}
else
{
UE_LOG(LogPhysics, Warning, TEXT("AddConvexElemsToRigidActor: ConvexElem is missing ConvexMesh (%d: %s)"), i, *BodySetup->GetPathName());
}
}
}