FRotator’s default constructor doesnt initialize yaw, pitch and roll. Most of the time they are zero but sometimes its some random value. When i use the default constructor i expect the member variable to be initialized as well and it gives very confusing bugs
I would have to disagree because sometimes I want to pass a non initialized rotator by ref to a function and have it fill in the values which slightly more effecient.
They did think about your request and added this ForceInit constructor, the two other ways are usually how I initialize a rotator with 0.
FRotator Rot(EForceInit::ForceInit);
FRotator Rot = FRotator::ZeroRotator;
FRotator Rot(0.f);
I could be wrong but I believe UPROPERTY are automatically initialized to 0
1 Like
Ok thats good to know,
Thanks for sharing
1 Like