A
A
AntiVassal2021-04-09 22:22:03
unreal engine
AntiVassal, 2021-04-09 22:22:03

Why is UCameraComponent not working?

There is a ChessPawn class. It creates a Camera and a SpringArmComponent. But when the Play button is pressed, a CameraActor is created, from which the scene is viewed.

this->camera = this->CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
this->springArm = this->CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));
this->springArm->TargetArmLength = 8000;
this->SetRootComponent(this->springArm);
this->camera->SetupAttachment(this->springArm);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AntiVassal, 2021-04-11
@AntiVassal

It turned out that I attached the camera incorrectly. It was necessary like this:

this->camera->SetupAttachment(this->springArm, USpringArmComponent::SocketName);

A
Alexei No, 2021-04-10
@alien2023

In my opinion, you just need to activate the camera when the player enters the game.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question