Skip to content

Commit

Permalink
Fixes crashes when enabling noclip in Vera Plane
Browse files Browse the repository at this point in the history
  • Loading branch information
fadillzzz committed Apr 6, 2024
1 parent 12e1f56 commit f2681dc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/feats/no_clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,21 @@ namespace Feats {
}

if (enabled) {
character->CapsuleComponent->SetCollisionEnabled(SDK::ECollisionEnabled::NoCollision);
character->CharacterMovement->SetMovementMode(SDK::EMovementMode::MOVE_Falling, 0);
const auto world = Globals::getWorld();

// Hackish solution to avoid crashing when enabling no clip in Vera Plane
if (world->GetName() == "Vera_P") {
SDK::UKismetSystemLibrary::CollectGarbage();
// Waiting for garbage collection to finish. There's no good way to do this, so we chose an
// arbitrary amount of time and hope for the best.
std::this_thread::sleep_for(std::chrono::milliseconds(150));
}

character->SetActorEnableCollision(false);
} else {
character->CharacterMovement->SetMovementMode(SDK::EMovementMode::MOVE_Walking, 0);
character->CapsuleComponent->SetCollisionEnabled(SDK::ECollisionEnabled::QueryAndPhysics);
character->SetActorEnableCollision(true);
}
}
}
Expand Down

0 comments on commit f2681dc

Please sign in to comment.