Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Pham <[email protected]>
Signed-off-by: Michał Pełka <[email protected]>
  • Loading branch information
michalpelka and spham-amzn authored Jul 19, 2023
1 parent 29c100e commit 34bd9ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace ROS2

AZ::ConstSplinePtr splinePtr{ nullptr };
LmbrCentral::SplineComponentRequestBus::EventResult(splinePtr, m_entity->GetId(), &LmbrCentral::SplineComponentRequests::GetSpline);
AZ_Assert(splinePtr, "Spline pointer is null");
AZ_Assert(splinePtr, "Unable to get spline for entity id (%s)", m_entity->GetId().ToString().c_str());

if (splinePtr)
{
Expand All @@ -137,6 +137,7 @@ namespace ROS2
m_splineLength = GetSplineLength(splinePtr);

// initial segment population
AZ_Assert(m_splineLength != 0.0f, "m_splineLength must be non-zero");
const float normalizedDistanceStep = SegmentSeparation * m_configuration.m_segmentSize / m_splineLength;
for (float normalizedIndex = 0.f; normalizedIndex < 1.f; normalizedIndex += normalizedDistanceStep)
{
Expand All @@ -151,6 +152,7 @@ namespace ROS2
AZ::ConstSplinePtr splinePtr, float normalizedLocation)
{
AzPhysics::SystemInterface* physicsSystem = AZ::Interface<AzPhysics::SystemInterface>::Get();
AZ_Assert( physicsSystem != nullptr, "Unable to get Physics System");

auto colliderConfiguration = AZStd::make_shared<Physics::ColliderConfiguration>();
colliderConfiguration->m_isInSceneQueries = false;
Expand Down Expand Up @@ -293,6 +295,7 @@ namespace ROS2
}

AzPhysics::SceneInterface* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get();
AZ_Assert( sceneInterface != nullptr, "Unable to get Scene Interface");
// update positions of the segments
for (auto& [pos, handle] : m_conveyorSegments)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ namespace ROS2
//! @return the location of the segment in world space
AZ::Vector3 GetLocationOfSegment(const AzPhysics::SimulatedBodyHandle handle);

//! Obtains the transform of of the pose on the spline at the given distance
//! Obtains the transform of the pose on the spline at the given distance
//! @param splinePtr the spline to obtain the transform from
//! @param distanceNormalized the distance along the spline to obtain the transform from (normalized)
//! @return the transform of the pose on the spline at the given distance
AZ::Transform GetTransformFromSpline(AZ::ConstSplinePtr splinePtr, float distanceNormalized);

//! Spawn rigid body at the given location
//! Spawn a rigid body at the given location
//! @param splinePtr the spline to spawn the rigid body on
//! @param location the location to spawn the rigid body at (normalized)
//! @return a pair of the normalized location and the handle of the simulated body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace ROS2
&ConveyorBeltComponentConfiguration::m_segmentSize,
"Segment Size",
"Size of simulated segments. Short segments might affect performance"
"physics engine.")
"of the physics engine.")
->DataElement(
AZ::Edit::UIHandlers::Default,
&ConveyorBeltComponentConfiguration::m_textureScale,
Expand All @@ -59,7 +59,7 @@ namespace ROS2
->DataElement(
AZ::Edit::UIHandlers::Default,
&ConveyorBeltComponentConfiguration::m_graphicalMaterialSlot,
"Graphical Material slot ",
"Graphical Material slot",
"The graphical material slot name to have its UV coordinates animated.")
->Attribute(AZ::Edit::Attributes::DefaultAsset, &GetDefaultPhysicsMaterialAssetId)
->Attribute(AZ_CRC_CE("EditButton"), "")
Expand Down

0 comments on commit 34bd9ef

Please sign in to comment.