本文整理汇总了C++中UPrimitiveComponent::DoesSocketExist方法的典型用法代码示例。如果您正苦于以下问题:C++ UPrimitiveComponent::DoesSocketExist方法的具体用法?C++ UPrimitiveComponent::DoesSocketExist怎么用?C++ UPrimitiveComponent::DoesSocketExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPrimitiveComponent
的用法示例。
在下文中一共展示了UPrimitiveComponent::DoesSocketExist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GripActor
bool UGripMotionControllerComponent::GripActor(
AActor* ActorToGrip,
const FTransform &WorldOffset,
bool bWorldOffsetIsRelative,
FName OptionalSnapToSocketName,
TEnumAsByte<EGripCollisionType> GripCollisionType,
bool bAllowSetMobility,
float GripStiffness,
float GripDamping,
bool bTurnOffLateUpdateWhenColliding
)
{
if (!bIsServer || !ActorToGrip)
{
UE_LOG(LogTemp, Warning, TEXT("VRGripMotionController grab function was passed an invalid or already gripped actor"));
return false;
}
UPrimitiveComponent *root = Cast<UPrimitiveComponent>(ActorToGrip->GetRootComponent());
if (!root)
{
UE_LOG(LogTemp, Warning, TEXT("VRGripMotionController tried to grip an actor without a UPrimitiveComponent Root"));
return false; // Need a primitive root
}
// Has to be movable to work
if (root->Mobility != EComponentMobility::Movable)
{
if (bAllowSetMobility)
root->SetMobility(EComponentMobility::Movable);
else
{
UE_LOG(LogTemp, Warning, TEXT("VRGripMotionController tried to grip an actor set to static mobility and bAllowSetMobility is false"));
return false; // It is not movable, can't grip it
}
}
root->IgnoreActorWhenMoving(this->GetOwner(), true);
// So that events caused by sweep and the like will trigger correctly
ActorToGrip->AddTickPrerequisiteComponent(this);
FBPActorGripInformation newActorGrip;
newActorGrip.GripCollisionType = GripCollisionType;
newActorGrip.Actor = ActorToGrip;
newActorGrip.bOriginalReplicatesMovement = ActorToGrip->bReplicateMovement;
newActorGrip.Stiffness = GripStiffness;
newActorGrip.Damping = GripDamping;
newActorGrip.bTurnOffLateUpdateWhenColliding = bTurnOffLateUpdateWhenColliding;
if (OptionalSnapToSocketName.IsValid() && root->DoesSocketExist(OptionalSnapToSocketName))
{
// I inverse it so that laying out the sockets makes sense
FTransform sockTrans = root->GetSocketTransform(OptionalSnapToSocketName, ERelativeTransformSpace::RTS_Component);
newActorGrip.RelativeTransform = sockTrans.Inverse();
newActorGrip.RelativeTransform.SetScale3D(ActorToGrip->GetActorScale3D());
}
else if (bWorldOffsetIsRelative)
newActorGrip.RelativeTransform = WorldOffset;
else
newActorGrip.RelativeTransform = WorldOffset.GetRelativeTransform(this->GetComponentTransform());
NotifyGrip(newActorGrip);
GrippedActors.Add(newActorGrip);
return true;
}