Compile Error

USceneComponent::RelativeRotation’: cannot access private member declared in class 'USceneComponent

I tried to use GetRelativeRotation() but then it wouldn’t add a FRotator with a float

What are you trying to do? What is the code that is in the course and what have you written?

This is in the battle tank game archive.

Building the TankBarrel static mesh component in the cpp file.

void UTankBarrel::Elevate(float RelativeSpeed)
{
     auto ElevationChange = RelativeSpeed * MaxDegrees * GetWorld()-> DeltaTimeSeconds;
     auto RawNewElevation = RelativeRotation.Pitch + ElevationChange;
}

I was using UE 2.25.
It looks like this error doesn’t come up in version 4.22

I know this is an archived lesson, but I’m really enjoying it and I really want to finish the project. I appreciate you still helping out.

That would just be changing RelativeRotation.Pitch to GetRelativeRotation().Pitch

That fixed my issue. Thank you.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms