移動方式一
void ACharacterBase::MoveForward(float speed)
{
if (speed != 0 && Controller) {
const FRotator rotation = GetControlRotation();
const FRotator yawRotaion(0, rotation.Yaw ,0);
FVector Direction = FRotationMatrix(yawRotaion).GetUnitAxis(EAxis::X);
AddMovementInput(Direction, speed);
}
}
void ACharacterBase::MoveRight(float speed)
{
if (speed != 0 && Controller) {
const FRotator rotation = GetControlRotation();
const FRotator yawRotaion(0, rotation.Yaw, 0);
FVector Direction = FRotationMatrix(yawRotaion).GetUnitAxis(EAxis::Y);
AddMovementInput(Direction, speed);
}
}