CARLA
Loading...
Searching...
No Matches
Functions
TrafficSignHeightUtils Namespace Reference

Helpers to snap OpenDRIVE-spawned traffic signs / lights onto the ground so they are not left floating in the air or sunk below the terrain. More...

Functions

bool AdjustLocationToGround (UWorld *World, FVector &Location, const TArray< AActor * > &IgnoredActors, const TArray< UPrimitiveComponent * > &IgnoredComponents)
 Line-trace downward to find the ground under Location.
 
bool AdjustSignToGround (UWorld *World, ATrafficSignBase *Sign, const TArray< AActor * > &IgnoredActors, const TArray< UPrimitiveComponent * > &IgnoredComponents)
 Snap a single traffic sign to the ground and shift its trigger UBoxComponents by the same delta so they stay aligned.
 

Detailed Description

Helpers to snap OpenDRIVE-spawned traffic signs / lights onto the ground so they are not left floating in the air or sunk below the terrain.

Function Documentation

◆ AdjustLocationToGround()

bool TrafficSignHeightUtils::AdjustLocationToGround ( UWorld *  World,
FVector &  Location,
const TArray< AActor * > &  IgnoredActors,
const TArray< UPrimitiveComponent * > &  IgnoredComponents 
)

Line-trace downward to find the ground under Location.

Every surface along the ray is considered and the first one that is ground wins, so a fence or other prop beside the pole is skipped instead of being treated as the ground. On hit, set Location.Z to the ground hit plus a small offset and return true; otherwise leave Location untouched and return false.

Definition at line 66 of file TrafficSignHeightUtils.cpp.

References carla::geom::Location::Location().

Referenced by AdjustSignToGround().

◆ AdjustSignToGround()

bool TrafficSignHeightUtils::AdjustSignToGround ( UWorld *  World,
ATrafficSignBase *  Sign,
const TArray< AActor * > &  IgnoredActors,
const TArray< UPrimitiveComponent * > &  IgnoredComponents 
)

Snap a single traffic sign to the ground and shift its trigger UBoxComponents by the same delta so they stay aligned.

Skips invalid signs, signs already positioned, and signs that were not generated from OpenDRIVE (hand-placed level actors are never moved). Sets Sign->bPositioned and returns true on success.

Definition at line 110 of file TrafficSignHeightUtils.cpp.

References AdjustLocationToGround(), ATrafficSignBase::bGeneratedFromOpenDRIVE, ATrafficSignBase::bPositioned, ATrafficSignBase::GetTriggerVolumes(), and IsValid().

Referenced by ATrafficLightManager::AdjustSpawnedSignsHeight(), and ATrafficLightManager::UpdateSignalGroundDormancy().