Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Bug while mantling on physic object #485

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Source/ALSV4_CPP/Private/Components/ALSMantleComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ void UALSMantleComponent::MantleStart(float MantleHeight, const FALSComponentAnd
OwnerCharacter->GetCharacterMovement()->SetMovementMode(MOVE_None);
OwnerCharacter->SetMovementState(EALSMovementState::Mantling);


//Check Physics for security
if (MantleLedgeLS.Component.Get()->IsSimulatingPhysics()) {
PhysicActor = true;
MantleLedgeLS.Component.Get()->SetSimulatePhysics(false);
}
else {
PhysicActor = false;
}


// Step 6: Configure the Mantle Timeline so that it is the same length as the
// Lerp/Correction curve minus the starting position, and plays at the same speed as the animation.
// Then start the timeline.
Expand Down Expand Up @@ -385,6 +396,10 @@ void UALSMantleComponent::MantleEnd()
{
Cast<AALSCharacter>(OwnerCharacter)->UpdateHeldObject();
}

if (PhysicActor) {
MantleLedgeLS.Component.Get()->SetSimulatePhysics(true);
}
}

// Enable ticking back after mantle ends
Expand Down
3 changes: 3 additions & 0 deletions Source/ALSV4_CPP/Public/Components/ALSMantleComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ class ALSV4_CPP_API UALSMantleComponent : public UActorComponent
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "ALS|Mantle System")
float AcceptableVelocityWhileMantling = 10.0f;

UPROPERTY()
bool PhysicActor;

private:
UPROPERTY()
TObjectPtr<AALSBaseCharacter> OwnerCharacter;
Expand Down