Error C2660: FMatrix::GetUnitAxis function does not take 1 arguments

I’m following Robert Slattery’s Delorean tutorial on YouTube for UE4 C++. In this instance in the video we’re setting up forward movement for a player character. When getting the forward vector I seem to get the following error. “Error C2660: FMatrix::GetUnitAxis function does not take 1 arguments”


// get forward vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxes(EAxis::X);

I’ve checked the includes and the header to make sure I didn’t miss anything, and the lines appear to be identical between the video and my project. Occasionally things get changed between versions so I’m assuming the way FRotationMatrix works may have changed?

Tutorial:

tut.PNG

Mine:

Error:
err.PNG

Thanks!

Hi, there is no such function in the documentation FRotationMatrix | Unreal Engine Documentation
If you want to get forward vector from rotator, you can use Vector function, or use GetForwardVector instead.


YawRotation.Vector();

Here is the code from engine source:


FVector UKismetMathLibrary::GetForwardVector(FRotator InRot)
{
    return InRot.Vector();
}

FVector UKismetMathLibrary::GetRightVector(FRotator InRot)
{
    return FRotationMatrix(InRot).GetScaledAxis(EAxis::Y);
}

FVector UKismetMathLibrary::GetUpVector(FRotator InRot)
{
    return FRotationMatrix(InRot).GetScaledAxis(EAxis::Z);
}

Caught my error. In GetUnitAxis, I wrote Axes.

2 Likes