61 - Rotate Root Bone
This commit is contained in:
parent
e0e4561594
commit
3b41ab1f9a
Binary file not shown.
|
@ -177,7 +177,11 @@ void ABlasterCharacter::AimOffset(float DeltaTime)
|
|||
FRotator CurrentAimRotation = FRotator(0.f, GetBaseAimRotation().Yaw, 0.f);
|
||||
FRotator DeltaAimRotation = UKismetMathLibrary::NormalizedDeltaRotator(CurrentAimRotation, StartingAimRotation);
|
||||
AO_Yaw = DeltaAimRotation.Yaw;
|
||||
bUseControllerRotationYaw = false;
|
||||
if (TurningInPlace == ETurningInPlace::ETIP_NotTurning)
|
||||
{
|
||||
InterpAO_Yaw = AO_Yaw;
|
||||
}
|
||||
bUseControllerRotationYaw = true;
|
||||
TurnInPlace(DeltaTime);
|
||||
}
|
||||
if (Speed > 0.f || bIsInAir) // Running or jumping
|
||||
|
@ -207,6 +211,7 @@ void ABlasterCharacter::ServerEquipButtonPressed_Implementation()
|
|||
|
||||
void ABlasterCharacter::TurnInPlace(float DeltaTime)
|
||||
{
|
||||
// UE_LOG(LogTemp, Warning, TEXT("AO_Yaw: %f"), AO_Yaw);
|
||||
if (AO_Yaw > 90.f)
|
||||
{
|
||||
TurningInPlace = ETurningInPlace::ETIP_Right;
|
||||
|
@ -215,6 +220,28 @@ void ABlasterCharacter::TurnInPlace(float DeltaTime)
|
|||
{
|
||||
TurningInPlace = ETurningInPlace::ETIP_Left;
|
||||
}
|
||||
if (TurningInPlace != ETurningInPlace::ETIP_NotTurning)
|
||||
{
|
||||
InterpAO_Yaw = FMath::FInterpTo(InterpAO_Yaw, 0.f, DeltaTime, 4.f);
|
||||
AO_Yaw = InterpAO_Yaw;
|
||||
if (FMath::Abs(AO_Yaw) < 15.f)
|
||||
{
|
||||
TurningInPlace = ETurningInPlace::ETIP_NotTurning;
|
||||
StartingAimRotation = FRotator(0.f, GetBaseAimRotation().Yaw, 0.f);
|
||||
}
|
||||
}
|
||||
switch (TurningInPlace)
|
||||
{
|
||||
case ETurningInPlace::ETIP_Left:
|
||||
UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: Left"));
|
||||
break;
|
||||
case ETurningInPlace::ETIP_Right:
|
||||
UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: Right"));
|
||||
break;
|
||||
case ETurningInPlace::ETIP_NotTurning:
|
||||
UE_LOG(LogTemp, Warning, TEXT("TurningInPlace: NotTurning"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ABlasterCharacter::SetOverlappingWeapon(AWeapon* Weapon)
|
||||
|
|
|
@ -55,6 +55,7 @@ private:
|
|||
void ServerEquipButtonPressed();
|
||||
|
||||
float AO_Yaw;
|
||||
float InterpAO_Yaw;
|
||||
float AO_Pitch;
|
||||
FRotator StartingAimRotation;
|
||||
|
||||
|
|
Loading…
Reference in New Issue