本文整理汇总了C++中UPrimitiveComponent::SetWorldTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ UPrimitiveComponent::SetWorldTransform方法的具体用法?C++ UPrimitiveComponent::SetWorldTransform怎么用?C++ UPrimitiveComponent::SetWorldTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPrimitiveComponent
的用法示例。
在下文中一共展示了UPrimitiveComponent::SetWorldTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TickGrip
void UGripMotionControllerComponent::TickGrip()
{
if (GrippedActors.Num())
{
FTransform WorldTransform;
FTransform InverseTransform = this->GetComponentTransform().Inverse();
for (int i = GrippedActors.Num() - 1; i >= 0; --i)
{
if (GrippedActors[i].Actor || GrippedActors[i].Component)
{
// GetRelativeTransformReverse had some serious fucking floating point errors associated with it that was fucking everything up
// Not sure whats wrong with the function but I might want to push a patch out eventually
WorldTransform = GrippedActors[i].RelativeTransform.GetRelativeTransform(InverseTransform);
UPrimitiveComponent *root = GrippedActors[i].Component;
AActor *actor = GrippedActors[i].Actor;
if (!root)
root = Cast<UPrimitiveComponent>(GrippedActors[i].Actor->GetRootComponent());
if (!root)
continue;
if (!actor)
actor = root->GetOwner();
if (!actor)
continue;
if (bIsServer)
{
// Handle collision intersection detection, this is used to intelligently manage some of the networking and late update features.
switch (GrippedActors[i].GripCollisionType.GetValue())
{
case EGripCollisionType::InteractiveCollisionWithPhysics:
case EGripCollisionType::InteractiveHybridCollisionWithSweep:
{
TArray<FOverlapResult> Hits;
FComponentQueryParams Params(NAME_None, this->GetOwner());
Params.bTraceAsyncScene = root->bCheckAsyncSceneOnMove;
Params.AddIgnoredActor(actor);
Params.AddIgnoredActors(root->MoveIgnoreActors);
if(GetWorld()->ComponentOverlapMulti(Hits, root, root->GetComponentLocation(), root->GetComponentQuat(), Params))
{
GrippedActors[i].bColliding = true;
}
else
{
GrippedActors[i].bColliding = false;
}
}
// Skip collision intersects with these types, they dont need it
case EGripCollisionType::PhysicsOnly:
case EGripCollisionType::SweepWithPhysics:
case EGripCollisionType::InteractiveCollisionWithSweep:
default:break;
}
}
// Need to figure out best default behavior
/*if (GrippedActors[i].bHasSecondaryAttachment && GrippedActors[i].SecondaryAttachment)
{
WorldTransform.SetRotation((WorldTransform.GetLocation() - GrippedActors[i].SecondaryAttachment->GetComponentLocation()).ToOrientationRotator().Quaternion());
}*/
if (GrippedActors[i].GripCollisionType == EGripCollisionType::InteractiveCollisionWithPhysics)
{
UpdatePhysicsHandleTransform(GrippedActors[i], WorldTransform);
}
else if (GrippedActors[i].GripCollisionType == EGripCollisionType::InteractiveCollisionWithSweep)
{
if (bIsServer)
{
FHitResult OutHit;
// Need to use without teleport so that the physics velocity is updated for when the actor is released to throw
root->SetWorldTransform(WorldTransform, true, &OutHit);
if (OutHit.bBlockingHit)
{
GrippedActors[i].bColliding = true;
if (!actor->bReplicateMovement)
actor->SetReplicateMovement(true);
}
else
{
GrippedActors[i].bColliding = false;
if (actor->bReplicateMovement)
actor->SetReplicateMovement(false);
}
}
else
{
if (!GrippedActors[i].bColliding)
{
//.........这里部分代码省略.........