Skip to content

Commit

Permalink
Changed rotation and position offsets for chrono. Disabled overlap ev…
Browse files Browse the repository at this point in the history
…ents for some meshes
  • Loading branch information
Axel1092 committed Nov 22, 2022
1 parent 1e6472a commit 4d92f93
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,14 @@ void ACarlaGameModeBase::EnableOverlapEvents()
AStaticMeshActor *MeshActor = CastChecked<AStaticMeshActor>(Actor);
if(MeshActor->GetStaticMeshComponent()->GetStaticMesh() != NULL)
{
if (MeshActor->GetStaticMeshComponent()->GetGenerateOverlapEvents() == false)
auto MeshTag = ATagger::GetTagOfTaggedComponent(*MeshActor->GetStaticMeshComponent());
namespace crp = carla::rpc;
if (MeshTag != crp::CityObjectLabel::Roads &&
MeshTag != crp::CityObjectLabel::Sidewalks &&
MeshTag != crp::CityObjectLabel::RoadLines &&
MeshTag != crp::CityObjectLabel::Ground &&
MeshTag != crp::CityObjectLabel::Terrain &&
MeshActor->GetStaticMeshComponent()->GetGenerateOverlapEvents() == false)
{
MeshActor->GetStaticMeshComponent()->SetGenerateOverlapEvents(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ void UChronoMovementComponent::TickComponent(float DeltaTime,
AdvanceChronoSimulation(DeltaTime);
}

auto VehiclePos = Vehicle->GetVehiclePos() - ChVector<>(0,0,0.5);
const auto ChronoPositionOffset = ChVector<>(0,0,-0.25f);
auto VehiclePos = Vehicle->GetVehiclePos() + ChronoPositionOffset;
auto VehicleRot = Vehicle->GetVehicleRot();
double Time = Vehicle->GetSystem()->GetChTime();

Expand All @@ -281,7 +282,11 @@ void UChronoMovementComponent::TickComponent(float DeltaTime,
return;
}
CarlaVehicle->SetActorLocation(NewLocation);
CarlaVehicle->SetActorRotation(NewRotation);
FRotator NewRotator = NewRotation.Rotator();
// adding small rotation to compensate chrono offset
const float ChronoPitchOffset = 2.5f;
NewRotator.Add(ChronoPitchOffset, 0.f, 0.f);
CarlaVehicle->SetActorRotation(NewRotator);
}

void UChronoMovementComponent::AdvanceChronoSimulation(float StepSize)
Expand Down

0 comments on commit 4d92f93

Please sign in to comment.