Removed double check for carsim mode.
This commit is contained in:
parent
c0986a07fc
commit
5b59d9ad14
|
@ -920,11 +920,7 @@ void FCarlaServer::FPimpl::BindActions()
|
|||
auto* CarlaVehicle = Cast<ACarlaWheeledVehicle>(ActorView.GetActor());
|
||||
// The physics in the vehicles works in a different way so to disable them.
|
||||
if (CarlaVehicle != nullptr){
|
||||
// Ignore the call for carsim
|
||||
if (!CarlaVehicle->GetCarlaMovementComponent<UCarSimManagerComponent>())
|
||||
{
|
||||
CarlaVehicle->SetSimulatePhysics(bEnabled);
|
||||
}
|
||||
CarlaVehicle->SetSimulatePhysics(bEnabled);
|
||||
}
|
||||
// The physics in the walkers also works in a different way so to disable them,
|
||||
// we need to do it in the UCharacterMovementComponent.
|
||||
|
|
|
@ -454,6 +454,11 @@ void ACarlaWheeledVehicle::SetCarlaMovementComponent(UBaseCarlaMovementComponent
|
|||
}
|
||||
|
||||
void ACarlaWheeledVehicle::SetSimulatePhysics(bool enabled) {
|
||||
if(!GetCarlaMovementComponent<UDefaultMovementComponent>())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UWheeledVehicleMovementComponent4W *Vehicle4W = Cast<UWheeledVehicleMovementComponent4W>(
|
||||
GetVehicleMovement());
|
||||
check(Vehicle4W != nullptr);
|
||||
|
@ -462,19 +467,16 @@ void ACarlaWheeledVehicle::SetSimulatePhysics(bool enabled) {
|
|||
return;
|
||||
|
||||
SetActorEnableCollision(true);
|
||||
if(!GetCarlaMovementComponent<UCarSimManagerComponent>())
|
||||
{
|
||||
auto RootComponent = Cast<UPrimitiveComponent>(GetRootComponent());
|
||||
RootComponent->SetSimulatePhysics(enabled);
|
||||
RootComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
|
||||
auto RootComponent = Cast<UPrimitiveComponent>(GetRootComponent());
|
||||
RootComponent->SetSimulatePhysics(enabled);
|
||||
RootComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
|
||||
|
||||
GetWorld()->GetPhysicsScene()->GetPxScene()->lockWrite();
|
||||
if(enabled)
|
||||
Vehicle4W->RecreatePhysicsState();
|
||||
else
|
||||
Vehicle4W->DestroyPhysicsState();
|
||||
GetWorld()->GetPhysicsScene()->GetPxScene()->unlockWrite();
|
||||
}
|
||||
GetWorld()->GetPhysicsScene()->GetPxScene()->lockWrite();
|
||||
if(enabled)
|
||||
Vehicle4W->RecreatePhysicsState();
|
||||
else
|
||||
Vehicle4W->DestroyPhysicsState();
|
||||
GetWorld()->GetPhysicsScene()->GetPxScene()->unlockWrite();
|
||||
|
||||
bPhysicsEnabled = enabled;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue