Help be understanding

Hi Ben…

I am trying to understand exactly whats going on here?
How things work?

auto RawNewElevation = RelativeRotation.Pitch + ElevationChange;
SetRelativeRotation(FRotator(RawNewElevation, 0, 0));

Thank you

The first line gets the current pitch and adds the change in elevation that gets calculated from values fed into the function.

The second line then makes an FRotator with the new pitch, and sets the rotation of the barrel to that FRotator.

Remember that the barrel only needs to adjust its pitch, as the turret does the lateral rotation and the barrel is a child of the turret.

I’m unsure to what else would be confusing, let me know.

Privacy & Terms