本文整理汇总了C++中UPrimitiveComponent::IsDeferringMovementUpdates方法的典型用法代码示例。如果您正苦于以下问题:C++ UPrimitiveComponent::IsDeferringMovementUpdates方法的具体用法?C++ UPrimitiveComponent::IsDeferringMovementUpdates怎么用?C++ UPrimitiveComponent::IsDeferringMovementUpdates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPrimitiveComponent
的用法示例。
在下文中一共展示了UPrimitiveComponent::IsDeferringMovementUpdates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckComponentWithSweep
bool UGripMotionControllerComponent::CheckComponentWithSweep(UPrimitiveComponent * ComponentToCheck, FVector Move, FRotator newOrientation, bool bSkipSimulatingComponents/*, bool &bHadBlockingHitOut*/)
{
TArray<FHitResult> Hits;
// WARNING: HitResult is only partially initialized in some paths. All data is valid only if bFilledHitResult is true.
FHitResult BlockingHit(NoInit);
BlockingHit.bBlockingHit = false;
BlockingHit.Time = 1.f;
bool bFilledHitResult = false;
bool bMoved = false;
bool bIncludesOverlapsAtEnd = false;
bool bRotationOnly = false;
UPrimitiveComponent *root = ComponentToCheck;
if (!root || !root->IsQueryCollisionEnabled())
return false;
FVector start(root->GetComponentLocation());
const bool bCollisionEnabled = root->IsQueryCollisionEnabled();
if (bCollisionEnabled)
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (!root->IsRegistered())
{
UE_LOG(LogTemp, Warning, TEXT("MovedComponent %s not initialized in grip motion controller"), *root->GetFullName());
}
#endif
UWorld* const MyWorld = GetWorld();
FComponentQueryParams Params(TEXT("sweep_params"), root->GetOwner());
FCollisionResponseParams ResponseParam;
root->InitSweepCollisionParams(Params, ResponseParam);
bool const bHadBlockingHit = MyWorld->ComponentSweepMulti(Hits, root, start, start + Move, newOrientation, Params);
if (bHadBlockingHit)
{
int32 BlockingHitIndex = INDEX_NONE;
float BlockingHitNormalDotDelta = BIG_NUMBER;
for (int32 HitIdx = 0; HitIdx < Hits.Num(); HitIdx++)
{
const FHitResult& TestHit = Hits[HitIdx];
// Ignore the owning actor to the motion controller
if (TestHit.Actor == this->GetOwner() || (bSkipSimulatingComponents && TestHit.Component->IsSimulatingPhysics()))
{
if (Hits.Num() == 1)
{
//bHadBlockingHitOut = false;
return false;
}
else
continue;
}
if (TestHit.bBlockingHit && TestHit.IsValidBlockingHit())
{
if (TestHit.Time == 0.f)
{
// We may have multiple initial hits, and want to choose the one with the normal most opposed to our movement.
const float NormalDotDelta = (TestHit.ImpactNormal | Move);
if (NormalDotDelta < BlockingHitNormalDotDelta)
{
BlockingHitNormalDotDelta = NormalDotDelta;
BlockingHitIndex = HitIdx;
}
}
else if (BlockingHitIndex == INDEX_NONE)
{
// First non-overlapping blocking hit should be used, if an overlapping hit was not.
// This should be the only non-overlapping blocking hit, and last in the results.
BlockingHitIndex = HitIdx;
break;
}
//}
}
}
// Update blocking hit, if there was a valid one.
if (BlockingHitIndex >= 0)
{
BlockingHit = Hits[BlockingHitIndex];
bFilledHitResult = true;
}
}
}
// Handle blocking hit notifications. Avoid if pending kill (which could happen after overlaps).
if (BlockingHit.bBlockingHit && !root->IsPendingKill())
{
check(bFilledHitResult);
if (root->IsDeferringMovementUpdates())
{
FScopedMovementUpdate* ScopedUpdate = root->GetCurrentScopedMovement();
ScopedUpdate->AppendBlockingHitAfterMove(BlockingHit);
}
else
//.........这里部分代码省略.........