Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #129 from Nick-Pearson/testing
Browse files Browse the repository at this point in the history
Char: no longer can jump during slide,
  • Loading branch information
corinv authored Apr 18, 2018
2 parents 76f8177 + 0fef86b commit 15efa5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Git LFS file not shown
14 changes: 11 additions & 3 deletions ParkourGame/Source/ParkourGame/Private/ParkourGameCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,11 @@ void AParkourGameCharacter::SetRagdollOnBodyPart_Implementation(EBodyPart Part,
OnRep_RagdollState();
}

bool AParkourGameCharacter::SetFullRagdoll_Validate(bool bIsFullRagdoll) { return true; }
void AParkourGameCharacter::SetFullRagdoll_Implementation(bool bIsFullRagdoll)
bool AParkourGameCharacter::SetFullRagdoll_Validate(bool bIsFullRagdoll, bool bFromSlide) { return true; }
void AParkourGameCharacter::SetFullRagdoll_Implementation(bool bIsFullRagdoll, bool bFromSlide)
{

bWasSliding = bFromSlide;
m_RagdollState[(int32)EBodyPart::MAX] = bIsFullRagdoll ? 1 : 0;
OnRep_RagdollState();
OnRagdoll.Broadcast();
Expand Down Expand Up @@ -1184,9 +1186,15 @@ void AParkourGameCharacter::CapsuleToRagdoll()
{
USkeletalMeshComponent* PlayerMesh = GetSkeletalMesh();
if (m_RagdollState[(int32)EBodyPart::MAX] > 0) {
//handle capsule position differently if sliding, for the camera's sake
FVector offset = FVector(0.0, 0.0, 0.0);
if (bWasSliding) {
offset = FVector(0.0, 0.0, 97.0);
}

FVector SocketLocation = PlayerMesh->GetSocketLocation(UParkourHelperLibrary::GetRootBoneForBodyPart(EBodyPart::Pelvis));
UCapsuleComponent* Capsule = GetCapsuleComponent();
Capsule->SetWorldLocation(SocketLocation);
Capsule->SetWorldLocation(SocketLocation + offset);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class AParkourGameCharacter : public ACharacter
void SetRagdollOnBodyPart(EBodyPart Part, bool bNewRagdoll);

UFUNCTION(BlueprintCallable, Category = "Physics", Server, Reliable, WithValidation)
void SetFullRagdoll(bool bIsFullRagdoll);
void SetFullRagdoll(bool bIsFullRagdoll, bool bFromSlide = false);

UFUNCTION(BlueprintPure, Category = "Physics")
bool IsFullRagdoll() const;
Expand Down Expand Up @@ -432,6 +432,7 @@ class AParkourGameCharacter : public ACharacter
UFUNCTION()
void OnGameOver(AMiniGameBase* Game, EMiniGameEndReason Reason);

UFUNCTION(BlueprintCallable, Category = "CharacterState")
void EnableJumping(bool Enable = true);

private:
Expand Down Expand Up @@ -483,5 +484,6 @@ class AParkourGameCharacter : public ACharacter
class AParkourPlayerState* ParkourPlayerState;

bool bCanJump = true;
bool bWasSliding = false;
};

0 comments on commit 15efa5f

Please sign in to comment.