When I learn the example about first person shooter game at A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums
I got question,I know UInputComponent dispose of input events,I just need bind input event and function like this:
InputComponent->BindAxis(“MoveRight”, this, &AFPSCharacter::MoveRight);
but I don’t konw what dose the following code do:
void AFPSCharacter::MoveRight(float Value)
{
if ((Controller != NULL) && (Value != 0.0f))
{
// find out which way is right
const FRotator Rotation = Controller->GetControlRotation();
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
// add movement in that direction
AddMovementInput(Direction, Value);
}
}
I know first, I should get controller rotation,then add an offset to the right deriction,but when open source code,I can’t understand the function GetScaledAxis() mean.
The following is all my guess:
FRotationMatrix(Rotation) will get a Matrix from Rotation,this matrix can transform actor to the rotation. But how can I understand GetScaledAxis(…) ? It just return the component of Y axis. what dose this mean,it can represent the right deriction?
Oh ! This question confuse me so long,I hope someone can help me !
thanks!