15 auto SpringArm = NewObject<USpringArmComponent>(Parent);
19 const auto ChildLocation = -Child->GetActorLocation();
20 Child->SetActorLocation(FVector::ZeroVector);
23 SpringArm->TargetOffset = FVector(0.0f, 0.0f, 30.0f);
26 FRotator LookAt = FRotationMatrix::MakeFromX(ChildLocation).Rotator();
28 SpringArm->SetupAttachment(Parent->GetRootComponent());
30 SpringArm->TargetArmLength = ChildLocation.Size();
31 SpringArm->bEnableCameraRotationLag =
true;
39 Parent->GetRootComponent(),
40 FAttachmentTransformRules::KeepRelativeTransform);
43 auto ChildComp = NewObject<UChildActorComponent>(Parent);
44 ChildComp->SetupAttachment(
46 USpringArmComponent::SocketName);
47 Child->AttachToComponent(
49 FAttachmentTransformRules::KeepRelativeTransform);
50 ChildComp->RegisterComponent();
57 auto SpringArm = NewObject<USpringArmComponent>(Parent);
61 const auto ChildLocation = -Child->GetActorLocation();
62 Child->SetActorLocation(FVector::ZeroVector);
65 SpringArm->TargetOffset = FVector(0.0f, 0.0f, 0.0f);
68 FRotator LookAt = FRotationMatrix::MakeFromX(ChildLocation).Rotator();
70 SpringArm->SetupAttachment(Parent->GetRootComponent());
72 SpringArm->TargetArmLength = ChildLocation.Size();
73 SpringArm->bEnableCameraRotationLag =
true;
81 Parent->GetRootComponent(),
82 FAttachmentTransformRules::KeepRelativeTransform);
85 auto ChildComp = NewObject<UChildActorComponent>(Parent);
86 ChildComp->SetupAttachment(
88 USpringArmComponent::SocketName);
89 Child->AttachToComponent(
91 FAttachmentTransformRules::KeepRelativeTransform);
92 ChildComp->RegisterComponent();