Skip to content

Commit

Permalink
Fix issues with view rotation replication when bReplicateMovement is …
Browse files Browse the repository at this point in the history
…set to false
  • Loading branch information
Sixze committed Sep 22, 2021
1 parent 1c10cb8 commit 1920132
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Binary file modified Content/ALSExtras/AI/BTTask_SetFocusToPlayer.uasset
Binary file not shown.
12 changes: 11 additions & 1 deletion Source/ALS/Private/AlsCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,22 @@ void AAlsCharacter::SetViewRotation(const FRotator& NewViewRotation)
ViewRotation = NewViewRotation;

MARK_PROPERTY_DIRTY_FROM_NAME(ThisClass, ViewRotation, this)

if (!IsReplicatingMovement() && GetLocalRole() == ROLE_AutonomousProxy)
{
ServerSetViewRotation(NewViewRotation);
}
}
}

void AAlsCharacter::ServerSetViewRotation_Implementation(const FRotator& NewViewRotation)
{
SetViewRotation(NewViewRotation);
}

void AAlsCharacter::RefreshView(const float DeltaTime)
{
if (GetLocalRole() >= ROLE_AutonomousProxy)
if (IsReplicatingMovement() && GetLocalRole() >= ROLE_AutonomousProxy || IsLocallyControlled())
{
SetViewRotation(Super::GetViewRotation().GetNormalized());
}
Expand Down
3 changes: 3 additions & 0 deletions Source/ALS/Public/AlsCharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ class ALS_API AAlsCharacter : public ACharacter
private:
void SetViewRotation(const FRotator& NewViewRotation);

UFUNCTION(Server, Unreliable)
void ServerSetViewRotation(const FRotator& NewViewRotation);

public:
const FAlsViewCharacterState& GetViewState() const;

Expand Down

0 comments on commit 1920132

Please sign in to comment.