I started learning Unreal Script 3 months back and was kind of ok with it. When UE4 got released I decided to switch engines. But now I am feeling as if I hit a wall. I need little help in understanding pointers. Generally the documentation and the wiki didn’t help me a lot. I know what c++ pointers are though.
Here is a small code from 3rd person which I want to start learning from.
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera) TSubobjectPtr<class USpringArmComponent> CameraBoom;
From what I understood, this creates a pointer of the class SpringArmComponent which
* This component tried to maintain its children at a fixed distance from the parent, * but will retract the children if there is a collision, and spring back when there is no collision.
I need help to understand what this do. And how does “->” work…
// Create a camera boom (pulls in towards the player if there is a collision) CameraBoom = PCIP.CreateDefaultSubobject<USpringArmComponent>(this, TEXT("CameraBoom")); CameraBoom->AttachTo(RootComponent); CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character CameraBoom->bUseControllerViewRotation = true; // Rotate the arm based on the controller
And this part
// Create a follow camera FollowCamera = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("FollowCamera")); FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation