Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Project/Gem/Source/VehicleController/VehicleController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ namespace RAIControl
->Field("predefinedPaths", &VehicleControllerConfig::m_predefinedPaths)
->Field("predefinedObstacles", &VehicleControllerConfig::m_predefinedObstacles)
->Field("vehicleLights", &VehicleControllerConfig::m_vehicleLights)
->Field("vehicleLightsIntensities", &VehicleControllerConfig::m_vehicleLightsIntensities);
->Field("vehicleLightsIntensities", &VehicleControllerConfig::m_vehicleLightsIntensities)
->Field("obstacleDistanceThreshold", &VehicleControllerConfig::m_obstacleDistanceThreshold);

if (auto editContext = serializeContext->GetEditContext())
{
Expand Down Expand Up @@ -112,7 +113,12 @@ namespace RAIControl
AZ::Edit::UIHandlers::Default,
&VehicleControllerConfig::m_vehicleLightsIntensities,
"Vehicle lights' intensities",
"List of the max. intensities for vehicle lights");
"List of the max. intensities for vehicle lights")
->DataElement(
AZ::Edit::UIHandlers::Default,
&VehicleControllerConfig::m_obstacleDistanceThreshold,
"Obstacle distance threshold",
"Distance threshold for the vehicle to stop when an obstacle is detected");
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Project/Gem/Source/VehicleController/VehicleController.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ namespace RAIControl
AZStd::vector<AZ::EntityId> m_predefinedObstacles;
AZStd::vector<AZ::EntityId> m_vehicleLights;
AZStd::vector<float> m_vehicleLightsIntensities;

// Distance from the obstacle at which the tractor will stop
float m_obstacleDistanceThreshold{ 7.0f };
};

} // namespace RAIControl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ namespace RAIControl
AZ::Vector3 obstacleTranslation = AZ::Vector3::CreateZero();
AZ::TransformBus::EventResult(obstacleTranslation, obstacleId, &AZ::TransformBus::Events::GetWorldTranslation);

if ((obstacleTranslation - vehiclePosition).GetLength() < 5.0)
if ((obstacleTranslation - vehiclePosition).GetLength() < m_configuration.m_obstacleDistanceThreshold)
{
// Set the flag and stop the vehicle
if (!m_obstacleDetected)
Expand Down
Loading