void APlayerCharacter::HorizontalStrafeMovement(float Value) { AddMovementInput(GetActorRightVector(), Value); }
void ACameraSampleCharacter::MoveCharacterForward(float changeValue) { //To change the movement speed, change max speed/acceleration/deceleration values //on the floating pawn movement component of the character blueprint AddMovementInput(GetActorForwardVector(), changeValue); }
void ACameraSampleCharacter::MoveCharacterRight(float changeValue) { AddMovementInput(GetActorRightVector(), changeValue); }
void APlayerCharacter::VerticalStrafeMovement(float Value) { AddMovementInput(GetActorForwardVector(), Value); }
void AShooterCharacter::MoveForward(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { // find out which way is forward const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get forward vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X); AddMovementInput(Direction, Value); } }
void AXtremeJanitorCharacter::MoveRight(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { // find out which way is right const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); // add movement in that direction AddMovementInput(Direction, Value); } }
void ABETCharacter::MoveRight(float Value) { if (Value != 0.0f) { // add movement in that direction AddMovementInput(GetActorRightVector(), Value); if (running == false) { if (WalkAudio != nullptr) UGameplayStatics::PlaySoundAtLocation(this, WalkAudio, GetActorLocation()); } if (running == true ) { if (RunAudio != nullptr) UGameplayStatics::PlaySoundAtLocation(this, RunAudio, GetActorLocation()); } } }
void AARCharacter::MoveForward(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { // find out which way is forward FRotator Rotation = GetBaseAimRotation(); FVector Location; //not used, just need for below. //Controller->GetPlayerViewPoint(Location, Rotation); Rotation.Normalize(); FRotator YawRotation(0, Rotation.Yaw, 0); const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X); AddMovementInput(Direction, Value); } }
void UBerserkCameraComponent::MoveRight(float value) { auto ownerPawn = GetOwnerPawn(); if (ownerPawn != nullptr) { auto playerController = GetPlayerController(); if ((value != 0.f) && (playerController != nullptr)) { const FRotationMatrix cameraRotation(playerController->PlayerCameraManager->GetCameraRotation()); const FVector worldSpaceAccel = cameraRotation.GetScaledAxis(EAxis::Y) * 100.0f; // transform to world space and add it ownerPawn->AddMovementInput(worldSpaceAccel, value); } } }
void AFPSCharacter::MoveForward(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { // find out which way is forward FRotator Rotation = Controller->GetControlRotation(); // Limit pitch when walking or falling if (CharacterMovement->IsMovingOnGround() || CharacterMovement->IsFalling()) { Rotation.Pitch = 0.0f; } // add movement in that direction const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X); AddMovementInput(Direction, Value); } }
void ABaseCharacter::moveRight(float Val) { //Positive values correspond to moving positively along the X axis if(Controller != NULL && Val != 0.0f) { FRotator dir = GetControlRotation(); dir.Yaw = (Val > 0.0f ? 0.0f : 180.0f); GetController()->SetControlRotation(dir); FRotator v = GetActorRotation(); v.Yaw = dir.Yaw; SetActorRotation(v); AddMovementInput(FVector(1.0f, 0.0f, 0.0f), Val); } }
void APlayerGameplay::MoveRight(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); AddMovementInput(Direction, Value); } if (playerGameplayAnim->Aiming) { playerGameplayAnim->SpeedX = Value * 100; } }
void ASideScrollerCharacter::MoveRight(float Value) { //GetCharacterMovement()->SetMovementMode(MOVE_Walking); HorizontalValue = Value; if (bIsClimbing || Value == 0) return; /*if (bIsClimbing) { GetCharacterMovement()->SetMovementMode(MOVE_Falling); bIsClimbing = false; }*/ AddMovementInput(FVector(1.0f, 0.0f, 0.0f), Value); }
void AGoldenOculusCharacter::MoveForward(float val) { if (Controller != NULL && val != 0.0f) { // get forward direction FRotator rotation = Controller->GetControlRotation(); // limit pitch when walking or falling if (CharacterMovement->IsMovingOnGround() || CharacterMovement->IsFalling()){ rotation.Pitch = 0.0f; } // add movement in that direction const FVector direction = FRotationMatrix(rotation).GetScaledAxis(EAxis::X); AddMovementInput(direction, val); } }
void ABaseCharacter::MoveForward(float Val) { //Checks if the controller is null and the movement value is greater than zero if ( (Controller != NULL) && (Val != 0.f) ) { //Gets the direction of the camera FRotator rotation = Controller->GetControlRotation(); if (CharacterMovement->IsMovingOnGround() || CharacterMovement->IsFalling()) { //Keeps the player from moving up or down. //Essentially creates the appearance of gravity rotation.Pitch = 0.f; } //Creates the direction of movement const FVector direction = FRotationMatrix(rotation).GetScaledAxis(EAxis::X); //Moves the player forward or backward AddMovementInput(direction, Val); } }
void AARCharacter::MoveRight(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { // find out which way is right //const FRotator Rotation = Controller->GetPlayerViewPoint(); FRotator Rotation; FVector Location; //not used, just need for below. Controller->GetPlayerViewPoint(Location, Rotation); Rotation.Normalize(); FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector //const FVector Direction = FRotationMatrix(YawRotation).GetScaledAxis(EAxis::Y); const FVector Direction = FRotationMatrix(YawRotation).GetScaledAxis(EAxis::Y); // add movement in that direction AddMovementInput(Direction, Value); } }
// Called every frame void AGGJ16_Player::Tick( float DeltaTime ) { Super::Tick( DeltaTime ); float Movement = 0.f; if (CurrentInputRotation.X != 0 || CurrentInputRotation.Y != 0) { Movement = 1.f; CalculateTargetRotation(); } AddMovementInput(GetActorForwardVector(), Movement); TArray<AActor*> OverlappingActors; InteractSense->GetOverlappingActors(OverlappingActors); for (AActor* CollidedActor : OverlappingActors) { ABaseInteract* curInteractObject = Cast<ABaseInteract>(CollidedActor); if (curInteractObject) { AVolcano* curVolcanoInteract = Cast<AVolcano>(curInteractObject); AInteractPlatform* curPlatformInteract = Cast<AInteractPlatform>(curInteractObject); if (curVolcanoInteract) { bCanInteract = true; } else if (curPlatformInteract) { if (!curPlatformInteract->bPlatformActive) { bCanInteract = true; } } } else { bCanInteract = false; } } }
void ARoguelikeChar::CharacterMoveForward(float AxisValue) { if (bIsDead)return; if (bIsAiming || PlayerAnimationInstance->bIsReloading) { PlayerAnimationInstance->MovementSpeedX = 0; FRotator X = PlayerCamera->GetForwardVector().Rotation(); CharacterMesh->SetWorldRotation(FRotator(0, X.Yaw, 0)); CharacterMesh->AddWorldRotation(FRotator(0, -90, 0)); return; } MoveDirY = AxisValue; float AxisVal = FMath::Abs(AxisValue); PlayerAnimationInstance->MovementSpeedX = AxisVal; if (AxisVal > 0.05f) { AddMovementInput(GetActorForwardVector(), AxisValue * MovementSpeed * GetWorld()->GetDeltaSeconds()); } FRotator X = PlayerCamera->GetForwardVector().Rotation(); if (bIsSprinting) { FVector ViewDirection = FVector(MoveDirY, MoveDirX, 0); CharacterMesh->SetWorldRotation(FRotator(0, ViewDirection.Rotation().Yaw + X.Yaw, 0)); CharacterMesh->AddWorldRotation(FRotator(0, -90, 0)); } else { FRotator X = PlayerCamera->GetForwardVector().Rotation(); CharacterMesh->SetWorldRotation(FRotator(0, X.Yaw, 0)); CharacterMesh->AddWorldRotation(FRotator(0, -90, 0)); } }
void AARCharacter::MoveRight(float Value) { if ((Controller != NULL) && (Value != 0.0f)) { FRotator Rotation; FVector Location; //not used, just need for below. Controller->GetPlayerViewPoint(Location, Rotation); Rotation.Normalize(); FRotator YawRotation(0, Rotation.Yaw, 0); const FVector Direction = FRotationMatrix(YawRotation).GetScaledAxis(EAxis::Y); // add movement in that direction AddMovementInput(Direction, Value); if (Value > 0) bIsStrafingRight = true; else if (Value < 0) bIsStrafingLeft = true; } else { bIsStrafingRight = false; bIsStrafingLeft = false; } }
void ACloud10Character::MoveRight(float Value) { if ( (Controller != NULL) && (Value != 0.0f) ) { // find out which way is right const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); // add movement in that direction AddMovementInput(Direction, Value); } //adjust yaw if (isDiving) { /*float val = 30; float axisVal; UStaticMeshComponent* smc = Cast<UStaticMeshComponent>(RootComponent); axisVal = Value * val; //add tilting movement control on left & right FRotator Rotation = GetActorRotation(); Rotation.Roll = Value; AddActorLocalRotation(Rotation);*/ //curRollAmt = Value; // find out which way is right /*const FRotator Rotation = Controller->GetControlRotation(); const FRotator YawRotation(0, Rotation.Yaw, 0); // get right vector const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); //smc->SetPhysicsLinearVelocity(Direction * axisVal); AddControllerYawInput((Direction * axisVal));*/ } }
/** * MOVEMENT FUNCTION * First checks if playercharacter exists. * Gets the current rotation of player. * Ignores changes in pitch if player is on ground or falling. * Gets rotation matrix to move. * Move in direction with Value speed. * * @param Value (rate to move). * @return void **/ void APlayerCharacter::MoveUpDown(float Value) { if (Controller && Value != 0.0f) { FRotator Rotation = GetActorRotation(); // Adds a rotation container, gets its rotation in degrees and stores it. if (GetCharacterMovement()) { if (bIsSprinting && CurrentSpeed != ConstSprintSpeed && !SpeedBoostActive) { SetSpeed(ConstSprintSpeed); } else if (!bIsSprinting && CurrentSpeed != OriginalWalkSpeed && !SpeedBoostActive) { SetSpeed(OriginalWalkSpeed); } } /* Get rotation to move */ FVector const Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X); AddMovementInput(Direction, Value); } }
void AFPSGCharacter::moveForward(float moveValue) { //Dont execute this input if the in game menu is open if (isInGameMenuOpen()) return; if (Controller != NULL && moveValue != 0.0f) { //Retrieve the viewing/aiming direction of the controlled pawn FRotator rotation = Controller->GetControlRotation(); //We want to limit the moving to the XY plane if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling()) { rotation.Pitch = 0.0f; } //Move the character const FVector moveDirection = FRotationMatrix(rotation).GetScaledAxis(EAxis::X); AddMovementInput(moveDirection, moveValue); if (moveValue == 1.0f) { if (movementDirection != EMoveDirection::FORWARD) { serverUpdateMovementDirection(static_cast<uint8>(EMoveDirection::FORWARD)); } } if (moveValue == -1.0f) { if (movementDirection != EMoveDirection::BACKWARD) { serverUpdateMovementDirection(static_cast<uint8>(EMoveDirection::BACKWARD)); } } } }
// Forward/Backward Movement Input void ARadeCharacter::MoveForward(float Value){ if (Value != 0.0f)AddMovementInput(GetActorForwardVector(), Value); }
/* Метод из домашнего задания * Здесь мы делаем ровным счетом то же самое, что и в методе MoveForward, * с разницей в том, что получаем вектор вправо Персонажа (вправо в Unreal'e - ось Y) */ void APlayableCharacter::MoveRight(float Step) { const FVector direction = FRotationMatrix(FRotator(0, GetControlRotation().Yaw, 0)).GetUnitAxis(EAxis::Y); AddMovementInput(direction, Step); }
void AFSMCharacterDemon::MoveForward(float Scale) { AddMovementInput(FVector(1 * Scale,0, 0)); }
void AFSMCharacter::MoveForward(float Value) { AddMovementInput(FVector(1.f, 0.f, 0.f), Value); }
void AFSMCharacter::MoveRight(float Value) { // add movement in that direction AddMovementInput(FVector(0.f,-1.f,0.f), Value); }
void AProject_SwaglordCharacter::Move(float Value) { // add movement in that direction AddMovementInput(FVector(1.f, 0.f,0.f), Value); }
void ASimonSaysCharacter::MoveRight(float Value) { AddMovementInput(FVector(1.0f, 0.0f, 0.0f), Value); }
// Right/Left Movement Input void ARadeCharacter::MoveRight(float Value){ if (Value != 0.0f)AddMovementInput(GetActorRightVector(), Value); }