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);
}
Exemplo n.º 5
-1
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);
	}


}
Exemplo n.º 7
-1
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());
			}
		}
}
Exemplo n.º 8
-1
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);

	}
}
Exemplo n.º 9
-1
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);
		}
	}
}
Exemplo n.º 10
-1
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);
	}
}
Exemplo n.º 11
-1
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);
    }
}
Exemplo n.º 12
-1
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);
	}
}
Exemplo n.º 15
-1
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);
	}
}
Exemplo n.º 16
-1
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);
	}
}
Exemplo n.º 17
-1
// 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;
		}
	}
}
Exemplo n.º 18
-1
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));
	}

}
Exemplo n.º 19
-1
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;
    }
}
Exemplo n.º 20
-1
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));*/
	}
}
Exemplo n.º 21
-1
/**
*	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);
	}
}
Exemplo n.º 22
-1
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));
			}
		}
	}
}
Exemplo n.º 23
-1
// 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);
}
Exemplo n.º 25
-1
void AFSMCharacterDemon::MoveForward(float Scale)
{
	AddMovementInput(FVector(1 * Scale,0, 0));
}
Exemplo n.º 26
-1
void AFSMCharacter::MoveForward(float Value)
{
	AddMovementInput(FVector(1.f, 0.f, 0.f), Value);
}
Exemplo n.º 27
-1
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);
}
Exemplo n.º 29
-1
void ASimonSaysCharacter::MoveRight(float Value)
{
    AddMovementInput(FVector(1.0f, 0.0f, 0.0f), Value);
}
Exemplo n.º 30
-1
// Right/Left Movement Input
void ARadeCharacter::MoveRight(float Value){
	if (Value != 0.0f)AddMovementInput(GetActorRightVector(), Value);
}