16 auto SpringArm = NewObject<USpringArmComponent>(Parent);
20 const auto ChildLocation = -Child->GetActorLocation();
21 Child->SetActorLocation(FVector::ZeroVector);
24 SpringArm->TargetOffset = FVector(0.0f, 0.0f, 30.0f);
27 FRotator LookAt = FRotationMatrix::MakeFromX(ChildLocation).Rotator();
29 SpringArm->SetupAttachment(Parent->GetRootComponent());
31 SpringArm->TargetArmLength = ChildLocation.Size();
32 SpringArm->bEnableCameraRotationLag =
true;
40 Parent->GetRootComponent(),
41 FAttachmentTransformRules::KeepRelativeTransform);
44 auto ChildComp = NewObject<UChildActorComponent>(Parent);
45 ChildComp->SetupAttachment(
47 USpringArmComponent::SocketName);
48 Child->AttachToComponent(
50 FAttachmentTransformRules::KeepRelativeTransform);
51 ChildComp->RegisterComponent();
58 auto SpringArm = NewObject<USpringArmComponent>(Parent);
62 const auto ChildLocation = -Child->GetActorLocation();
63 Child->SetActorLocation(FVector::ZeroVector);
66 SpringArm->TargetOffset = FVector(0.0f, 0.0f, 0.0f);
69 FRotator LookAt = FRotationMatrix::MakeFromX(ChildLocation).Rotator();
71 SpringArm->SetupAttachment(Parent->GetRootComponent());
73 SpringArm->TargetArmLength = ChildLocation.Size();
74 SpringArm->bEnableCameraRotationLag =
true;
82 Parent->GetRootComponent(),
83 FAttachmentTransformRules::KeepRelativeTransform);
86 auto ChildComp = NewObject<UChildActorComponent>(Parent);
87 ChildComp->SetupAttachment(
89 USpringArmComponent::SocketName);
90 Child->AttachToComponent(
92 FAttachmentTransformRules::KeepRelativeTransform);
93 ChildComp->RegisterComponent();