I add an URotatingMovementComponent to my actor, I can change it’s rotation rate value in editor but I wish to change it in c++, I tried setting the RotationRate variable of the component in the constructor and in the BeginPlay, either way it doesn’t work.
My code is:
.h
public:
// Sets default values for this actor's properties
APickup();
UPROPERTY(VisibleAnywhere, Category = Movement)
URotatingMovementComponent* Rotation;
.cpp
APickup::APickup()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Rotation = CreateDefaultSubobject<URotatingMovementComponent>(TEXT("Rotation"));
Rotation->RotationRate = { 0,0,180 };
}
I’m trying to change from X=180 Y=0 Z=0 (the default values), to X=0 Y=0 Z=180. But even changing the variable on begin play my actor keeps rotating in the X axis.
Here’s the default values on the editor:
What I have tried:
Restarting the engine and Visual Studio
Create a new derived blueprint
Using an FRotator declared on the .h to assing the Rotation rate
What I’m doing wrong here? Is there other way to set the rotation rate?
Obs.: My Visual Studio is set to Development Editor
Sorry for my bad english, not my first language, appretiate any help.