diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/StopSignComponent.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/StopSignComponent.cpp index 64f89cb98..c39ff07d9 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/StopSignComponent.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/StopSignComponent.cpp @@ -40,7 +40,7 @@ void UStopSignComponent::InitializeSign(const carla::road::Map &Map) // Get 90% of the half size of the width of the lane float BoxSize = static_cast( - 0.9*Map.GetLaneWidth(signal_waypoint)/2.0); + 0.9*Map.GetLaneWidth(signal_waypoint)*0.5); // Get min and max double LaneLength = Map.GetLane(signal_waypoint).GetLength(); double LaneDistance = Map.GetLane(signal_waypoint).GetDistance(); @@ -102,7 +102,7 @@ void UStopSignComponent::InitializeSign(const carla::road::Map &Map) auto CurrentWaypoint = Waypoint; auto NextWaypoint = CurrentWaypoint; float BoxSize = static_cast( - 0.9*Map.GetLaneWidth(NextWaypoint)/2.0); + 0.9*Map.GetLaneWidth(NextWaypoint)*0.5); float UEBoxSize = 100*BoxSize; GenerateCheckBox(Map.ComputeTransform(NextWaypoint), UEBoxSize); while (true) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficLightManager.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficLightManager.cpp index 52077cc03..a2e4d07aa 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficLightManager.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Traffic/TrafficLightManager.cpp @@ -267,7 +267,7 @@ void ATrafficLightManager::SpawnTrafficLights() (GetMap()->ComputeTransform(ClosestWaypointToSignal.get()).location - CarlaTransform.location).Length(); double LaneWidth = GetMap()->GetLaneWidth(ClosestWaypointToSignal.get()); - if(SignalDistanceToRoad < LaneWidth / 2.0) + if(SignalDistanceToRoad < LaneWidth * 0.5) { UE_LOG(LogCarla, Warning, TEXT("Traffic light %s overlaps a driving lane. Disabling collision..."), @@ -330,7 +330,7 @@ void ATrafficLightManager::SpawnSignals() (GetMap()->ComputeTransform(ClosestWaypointToSignal.get()).location - CarlaTransform.location).Length(); double LaneWidth = GetMap()->GetLaneWidth(ClosestWaypointToSignal.get()); - if(SignalDistanceToRoad < LaneWidth / 2.0) + if(SignalDistanceToRoad < LaneWidth * 0.5) { UE_LOG(LogCarla, Warning, TEXT("Traffic light %s overlaps a driving lane. Disabling collision..."), @@ -416,7 +416,7 @@ void ATrafficLightManager::GenerateTriggerBoxesForTrafficLights() // Get 90% of the half size of the width of the lane float BoxSize = static_cast( - 0.9*GetMap()->GetLaneWidth(waypoint)/2.0); + 0.9f*GetMap()->GetLaneWidth(waypoint)*0.5); // Get min and max double LaneLength = GetMap()->GetLane(signal_waypoint).GetLength(); double LaneDistance = GetMap()->GetLane(signal_waypoint).GetDistance();