Download

Make rotation from axes expects vectors?

Hello! I am trying to get a better hold of how to manage rotation, vectors, directions, length, magnitude, etc and how to convert them between eachother.

Currently I am trying to figure out how to convert axes into rotations and found that there’s a blueprint function that does just that:


[COLOR=#0000BB]FRotator UKismetMathLibrary::MakeRotationFromAxes(FVector Forward, FVector Right, FVector Up)
{
Forward.Normalize();
Right.Normalize();
Up.Normalize();

FMatrix RotMatrix(Forward, Right, Up, FVector::ZeroVector);

    return RotMatrix.Rotator();
}  [/COLOR]

However, it takes vectors instead of floats? Each of my input axes are just floats that defines if X is negative or positive, etc.

How would I do an equivalent with floats?

FRotator has a constructor that takes three floats:



FRotator MyRotation = FRotator(Pitch, Yaw, Roll);


Thanks! But I’m afraid that wouldn’t quite translate in my case. This would give me a pitch of 1 to -1 and yaw to 1 to -1.

The two inputs axis only handle yaw, the X axis is forwards and backwards direction, and the Y is sideways direction. Together they *behave *like a rotation, but I need to make them into an actual rotation.
So if the input is x = 1.0 and Y = 1.0 that makes the character move in a 45 degree angle. (Forwards + sideways).
But I actually need access to those 45 degrees.