Hi, while doing the challenge of this lesson I came across the Add function for the FRotator struct, and using it I wrote a code to open both of the doors of the example, regardless the rotation:
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
float DoorRotation = +90.f;
FRotator CurrentRotation = GetOwner() -> GetActorRotation();
GetOwner() -> SetActorRotation(CurrentRotation.Add(0.f,DoorRotation,0.f));
}
Is this a good solution?
Also I’m getting confused with the way some things are declared.
sometimes I can use curly braces and sometimes not.
For example, when storing all the axis values in an FRotator I was able to use an array-declaration type, so: FRotator TargetRotation = {0.f,DoorRotation,0.f} worked well. However when trying to use the same syntax for the .Add function for the rotator I would’ve expected to be able to use: .Add({value1,value2,value3}); but that didn’t work.
even If I was giving it the TargetRotation like this: .Add(TargetRotation); that wouldn’t work neither.
I know I must be mixing concepts here, could you point me to what to look for to understand this better?
thank you!