Explorar el Código

remove LmbrCentral navigation components

Signed-off-by: greerdv <[email protected]>
greerdv hace 2 años
padre
commit
12076a7c88
Se han modificado 22 ficheros con 0 adiciones y 2600 borrados
  1. 0 5
      Gems/LmbrCentral/Assets/Scripts/AI/Navigation.xml
  2. 0 437
      Gems/LmbrCentral/Code/Source/Ai/EditorNavigationAreaComponent.cpp
  3. 0 123
      Gems/LmbrCentral/Code/Source/Ai/EditorNavigationAreaComponent.h
  4. 0 99
      Gems/LmbrCentral/Code/Source/Ai/EditorNavigationSeedComponent.cpp
  5. 0 46
      Gems/LmbrCentral/Code/Source/Ai/EditorNavigationSeedComponent.h
  6. 0 23
      Gems/LmbrCentral/Code/Source/Ai/EditorNavigationUtil.cpp
  7. 0 20
      Gems/LmbrCentral/Code/Source/Ai/EditorNavigationUtil.h
  8. 0 882
      Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.cpp
  9. 0 349
      Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.h
  10. 0 107
      Gems/LmbrCentral/Code/Source/Ai/NavigationSystemComponent.cpp
  11. 0 59
      Gems/LmbrCentral/Code/Source/Ai/NavigationSystemComponent.h
  12. 0 5
      Gems/LmbrCentral/Code/Source/LmbrCentral.cpp
  13. 0 4
      Gems/LmbrCentral/Code/Source/LmbrCentralEditor.cpp
  14. 0 1
      Gems/LmbrCentral/Code/Tests/lmbrcentral_tests_files.cmake
  15. 0 35
      Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationAreaBus.h
  16. 0 302
      Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationComponentBus.h
  17. 0 28
      Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationSeedBus.h
  18. 0 59
      Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationSystemBus.h
  19. 0 8
      Gems/LmbrCentral/Code/lmbrcentral_editor_files.cmake
  20. 0 2
      Gems/LmbrCentral/Code/lmbrcentral_files.cmake
  21. 0 4
      Gems/LmbrCentral/Code/lmbrcentral_headers_files.cmake
  22. 0 2
      Gems/LmbrCentral/Code/lmbrcentral_shared_files.cmake

+ 0 - 5
Gems/LmbrCentral/Assets/Scripts/AI/Navigation.xml

@@ -1,5 +0,0 @@
-<Navigation version="6" >
-	<AgentTypes>
-		<AgentType name="MediumSizedCharacters" voxelSize="0.125, 0.125, 0.125" radius="4" height="16" climbableHeight="3" maxWaterDepth="8" />
-	</AgentTypes>
-</Navigation>

+ 0 - 437
Gems/LmbrCentral/Code/Source/Ai/EditorNavigationAreaComponent.cpp

@@ -1,437 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#include "EditorNavigationAreaComponent.h"
-
-#include "EditorNavigationUtil.h"
-#include <AzCore/Component/TransformBus.h>
-#include <AzCore/Serialization/EditContext.h>
-#include <AzCore/Serialization/SerializeContext.h>
-#include <LmbrCentral/Shape/PolygonPrismShapeComponentBus.h>
-#include <Shape/PolygonPrismShape.h>
-#include <MathConversion.h>
-
-namespace LmbrCentral
-{
-    static bool NavAgentValid(NavigationAgentTypeID navAgentId)
-    {
-        return navAgentId != NavigationAgentTypeID();
-    }
-
-    static bool NavVolumeValid(NavigationVolumeID navVolumeId)
-    {
-        return navVolumeId != NavigationVolumeID();
-    }
-
-    static bool NavMeshValid(NavigationMeshID navMeshId)
-    {
-        return navMeshId != NavigationMeshID();
-    }
-
-    void EditorNavigationAreaComponent::Reflect(AZ::ReflectContext* context)
-    {
-        if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
-        {
-            serializeContext->Class<EditorNavigationAreaComponent, AzToolsFramework::Components::EditorComponentBase>()
-                ->Field("AgentTypes", &EditorNavigationAreaComponent::m_agentTypes)
-                ->Field("Exclusion", &EditorNavigationAreaComponent::m_exclusion)
-                ;
-
-            if (AZ::EditContext* editContext = serializeContext->GetEditContext())
-            {
-                editContext->Class<EditorNavigationAreaComponent>("Navigation Area", "Navigation Area configuration")
-                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
-                        ->Attribute(AZ::Edit::Attributes::AddableByUser, false)
-                        ->Attribute(AZ::Edit::Attributes::Category, "AI")
-                        ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/NavigationArea.svg")
-                        ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/NavigationArea.svg")
-                        ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
-                        ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/ai/nav-area/")
-                        ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-                    ->DataElement(AZ::Edit::UIHandlers::CheckBox, &EditorNavigationAreaComponent::m_exclusion, "Exclusion", "Does this area add or subtract from the Navigation Mesh")
-                        ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorNavigationAreaComponent::OnNavigationAreaChanged)
-                    ->DataElement(AZ::Edit::UIHandlers::Default, &EditorNavigationAreaComponent::m_agentTypes, "Agent Types", "All agents that could potentially be used with this area")
-                        ->ElementAttribute(AZ::Edit::UIHandlers::Handler, AZ::Edit::UIHandlers::ComboBox)
-                        ->ElementAttribute(AZ::Edit::Attributes::StringList, &PopulateAgentTypeList)
-                        ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-                        ->Attribute(AZ::Edit::Attributes::AddNotify, &EditorNavigationAreaComponent::OnNavigationAreaChanged)
-                        ->Attribute(AZ::Edit::Attributes::RemoveNotify, &EditorNavigationAreaComponent::OnNavigationAreaChanged)
-                        ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorNavigationAreaComponent::OnNavigationAreaChanged)
-                        ;
-            }
-        }
-    }
-
-    EditorNavigationAreaComponent::EditorNavigationAreaComponent()
-        : m_navigationAreaChanged([this]() { UpdateMeshes(); ApplyExclusion(); })
-    {
-    }
-
-    EditorNavigationAreaComponent::~EditorNavigationAreaComponent()
-    {
-        DestroyArea();
-    }
-
-    void EditorNavigationAreaComponent::Activate()
-    {
-        EditorComponentBase::Activate();
-
-        const AZ::EntityId entityId = GetEntityId();
-        AZ::TransformNotificationBus::Handler::BusConnect(entityId);
-        ShapeComponentNotificationsBus::Handler::BusConnect(entityId);
-        NavigationAreaRequestBus::Handler::BusConnect(entityId);
-        AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusConnect();
-        AzToolsFramework::EntityCompositionNotificationBus::Handler::BusConnect();
-        AZ::TickBus::Handler::BusConnect();
-
-        // use the entity id as unique name to register area
-        m_name = GetEntityId().ToString();
-
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            // we only wish to register new areas (this area may have been
-            // registered when the navmesh was loaded at level load)
-            if (!aiNavigation->IsAreaPresent(m_name.c_str()))
-            {
-                aiNavigation->RegisterArea(m_name.c_str());
-            }
-        }
-
-        // reset switching to game mode on activate
-        m_switchingToGameMode = false;
-
-        // We must relink during entity activation or the NavigationSystem will throw 
-        // errors in SpawnJob. Don't force an unnecessary update of the game area.  
-        // RelinkWithMesh will still update the game area if the volume hasn't been created.
-        const bool updateGameArea = false;
-        RelinkWithMesh(updateGameArea);
-    }
-
-    void EditorNavigationAreaComponent::Deactivate()
-    {
-        // only destroy the area if we know we're not currently switching to game mode
-        // or changing our composition during scrubbing
-        if (!m_switchingToGameMode && !m_compositionChanging)
-        {
-            DestroyArea();
-        }
-
-        const AZ::EntityId entityId = GetEntityId();
-        AZ::TransformNotificationBus::Handler::BusDisconnect(entityId);
-        ShapeComponentNotificationsBus::Handler::BusDisconnect(entityId);
-        NavigationAreaRequestBus::Handler::BusDisconnect(entityId);
-        AzToolsFramework::EditorEntityContextNotificationBus::Handler::BusDisconnect();
-        AzToolsFramework::EntityCompositionNotificationBus::Handler::BusDisconnect();
-        AZ::TickBus::Handler::BusDisconnect();
-
-        EditorComponentBase::Deactivate();
-    }
-
-    void EditorNavigationAreaComponent::OnNavigationEvent(const INavigationSystem::ENavigationEvent event)
-    {
-        switch (event)
-        {
-        case INavigationSystem::MeshReloaded:
-        case INavigationSystem::NavigationCleared:
-            RelinkWithMesh(true);
-            break;
-        case INavigationSystem::MeshReloadedAfterExporting:
-            RelinkWithMesh(false);
-            break;
-        default:
-            AZ_Assert(false, "Unhandled ENavigationEvent: %d", event);
-            break;
-        }
-    }
-
-    void EditorNavigationAreaComponent::OnShapeChanged(ShapeChangeReasons /*changeReason*/)
-    {
-        UpdateGameArea();
-    }
-
-    void EditorNavigationAreaComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& /*world*/)
-    {
-        UpdateGameArea();
-    }
-
-    void EditorNavigationAreaComponent::RefreshArea()
-    {
-        UpdateGameArea();
-    }
-
-    void EditorNavigationAreaComponent::UpdateGameArea()
-    {
-        using namespace PolygonPrismUtil;
-
-        AZ::Transform transform = AZ::Transform::CreateIdentity();
-        AZ::TransformBus::EventResult(transform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
-
-        AZ::ConstPolygonPrismPtr polygonPrismPtr = nullptr;
-        PolygonPrismShapeComponentRequestBus::EventResult(polygonPrismPtr, GetEntityId(), &PolygonPrismShapeComponentRequests::GetPolygonPrism);
-
-        if (!polygonPrismPtr)
-        {
-            AZ_Error("EditorNavigationAreaComponent", false, "Polygon prism does not exist for navigation area.");
-            return;
-        }
-
-        const AZ::PolygonPrism& polygonPrism = *polygonPrismPtr;
-
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            const size_t vertexCount = polygonPrism.m_vertexContainer.Size();
-            const AZStd::vector<AZ::Vector2>& verticesLocal = polygonPrism.m_vertexContainer.GetVertices();
-
-            if (vertexCount > 2)
-            {
-                AZStd::vector<AZ::Vector3> verticesWorld;
-                verticesWorld.reserve(vertexCount);
-
-                for (size_t i = 0; i < vertexCount; ++i)
-                {
-                    verticesWorld.push_back(transform.TransformPoint(AZ::Vector3(verticesLocal[i])));
-                }
-
-                // The volume could be set but if the binary data didn't exist the volume was not correctly recreated
-                if (!NavVolumeValid(NavigationVolumeID(m_volume)) || !aiNavigation->ValidateVolume(NavigationVolumeID(m_volume)))
-                {
-                    CreateVolume(&verticesWorld[0], verticesWorld.size(), NavigationVolumeID(m_volume));
-                }
-                else
-                {
-                    AZStd::vector<Vec3> cryVertices;
-                    cryVertices.reserve(vertexCount);
-
-                    for (size_t i = 0; i < vertexCount; ++i)
-                    {
-                        cryVertices.push_back(AZVec3ToLYVec3(verticesWorld[i]));
-                    }
-
-                    aiNavigation->SetVolume(NavigationVolumeID(m_volume), &cryVertices[0], cryVertices.size(), polygonPrism.GetHeight());
-                }
-
-                UpdateMeshes();
-                ApplyExclusion();
-            }
-            else if (NavVolumeValid(NavigationVolumeID(m_volume)))
-            {
-                DestroyArea();
-            }
-        }
-    }
-
-    void EditorNavigationAreaComponent::UpdateMeshes()
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            if (m_exclusion)
-            {
-                DestroyMeshes();
-            }
-            else
-            {
-                const size_t agentTypeCount = m_agentTypes.size();
-                m_meshes.resize(agentTypeCount);
-
-                for (size_t i = 0; i < agentTypeCount; ++i)
-                {
-                    NavigationMeshID meshId = NavigationMeshID(m_meshes[i]);
-                    const NavigationAgentTypeID agentTypeId = aiNavigation->GetAgentTypeID(m_agentTypes[i].c_str());
-
-                    if (NavAgentValid(agentTypeId) && !meshId)
-                    {
-                        INavigationSystem::CreateMeshParams params; // TODO: expose at least the tile size
-                        meshId = aiNavigation->CreateMesh(m_name.c_str(), agentTypeId, params);
-                        aiNavigation->SetMeshBoundaryVolume(meshId, NavigationVolumeID(m_volume));
-
-                        AZ::Transform transform = AZ::Transform::CreateIdentity();
-                        AZ::TransformBus::EventResult(transform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
-
-                        AZ::ConstPolygonPrismPtr polygonPrismPtr;
-                        PolygonPrismShapeComponentRequestBus::EventResult(polygonPrismPtr, GetEntityId(), &PolygonPrismShapeComponentRequests::GetPolygonPrism);
-
-                        const AZ::PolygonPrism& polygonPrism = *polygonPrismPtr;
-                        aiNavigation->QueueMeshUpdate(meshId, AZAabbToLyAABB(PolygonPrismUtil::CalculateAabb(polygonPrism, transform)));
-
-                        m_meshes[i] = meshId;
-                    }
-                    else if (!NavAgentValid(agentTypeId) && meshId)
-                    {
-                        aiNavigation->DestroyMesh(meshId);
-                        m_meshes[i] = 0;
-                    }
-                }
-            }
-        }
-    }
-
-    void EditorNavigationAreaComponent::ApplyExclusion()
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            std::vector<NavigationAgentTypeID> affectedAgentTypes;
-
-            if (m_exclusion)
-            {
-                const size_t agentTypeCount = m_agentTypes.size();
-                affectedAgentTypes.reserve(agentTypeCount);
-
-                for (size_t i = 0; i < agentTypeCount; ++i)
-                {
-                    NavigationAgentTypeID agentTypeID = aiNavigation->GetAgentTypeID(m_agentTypes[i].c_str());
-                    affectedAgentTypes.push_back(agentTypeID);
-                }
-            }
-
-            if (affectedAgentTypes.empty())
-            {
-                // this will remove this volume from all agent type and mesh exclusion containers
-                aiNavigation->SetExclusionVolume(0, 0, NavigationVolumeID(m_volume));
-            }
-            else
-            {
-                aiNavigation->SetExclusionVolume(&affectedAgentTypes[0], affectedAgentTypes.size(), NavigationVolumeID(m_volume));
-            }
-        }
-    }
-
-    void EditorNavigationAreaComponent::RelinkWithMesh(bool updateGameArea)
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            m_volume = aiNavigation->GetAreaId(m_name.c_str());
-
-            if (!m_exclusion)
-            {
-                const size_t agentTypeCount = m_agentTypes.size();
-                m_meshes.resize(agentTypeCount);
-
-                for (size_t i = 0; i < agentTypeCount; ++i)
-                {
-                    const NavigationAgentTypeID agentTypeId = aiNavigation->GetAgentTypeID(m_agentTypes[i].c_str());
-                    m_meshes[i] = aiNavigation->GetMeshID(m_name.c_str(), agentTypeId);
-                }
-            }
-
-            // Update the game area if requested or in the case that the volume doesn't exist yet.
-            // This can happen when a volume doesn't have an associated mesh which is always the  
-            // case with exclusion volumes.
-            if (updateGameArea || !aiNavigation->ValidateVolume(NavigationVolumeID(m_volume)))
-            {
-                UpdateGameArea();
-            }
-        }
-    }
-
-    void EditorNavigationAreaComponent::CreateVolume(AZ::Vector3* vertices, size_t vertexCount, NavigationVolumeID requestedID)
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            AZStd::vector<Vec3> cryVertices;
-            cryVertices.reserve(vertexCount);
-
-            for (size_t i = 0; i < vertexCount; ++i)
-            {
-                cryVertices.push_back(AZVec3ToLYVec3(vertices[i]));
-            }
-
-            AZ::ConstPolygonPrismPtr polygonPrismPtr;
-            PolygonPrismShapeComponentRequestBus::EventResult(polygonPrismPtr, GetEntityId(), &PolygonPrismShapeComponentRequests::GetPolygonPrism);
-
-            const AZ::PolygonPrism& polygonPrism = *polygonPrismPtr;
-            m_volume = aiNavigation->CreateVolume(cryVertices.begin(), vertexCount, polygonPrism.GetHeight(), requestedID);
-            aiNavigation->RegisterListener(this, m_name.c_str());
-
-            if (!NavVolumeValid(requestedID))
-            {
-                aiNavigation->SetAreaId(m_name.c_str(), NavigationVolumeID(m_volume));
-            }
-        }
-    }
-
-    void EditorNavigationAreaComponent::DestroyVolume()
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            if (NavVolumeValid(NavigationVolumeID(m_volume)))
-            {
-                aiNavigation->DestroyVolume(NavigationVolumeID(m_volume));
-                aiNavigation->UnRegisterListener(this);
-
-                m_volume = NavigationVolumeID();
-            }
-        }
-    }
-
-    void EditorNavigationAreaComponent::DestroyMeshes()
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            for (size_t i = 0; i < m_meshes.size(); ++i)
-            {
-                if (NavMeshValid(NavigationMeshID(m_meshes[i])))
-                {
-                    aiNavigation->DestroyMesh(NavigationMeshID(m_meshes[i]));
-                }
-            }
-
-            m_meshes.clear();
-        }
-    }
-
-    void EditorNavigationAreaComponent::DestroyArea()
-    {
-        INavigationSystem* aiNavigation = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (aiNavigation)
-        {
-            aiNavigation->UnRegisterArea(m_name.c_str());
-            DestroyMeshes();
-            DestroyVolume();
-        }
-    }
-
-    void EditorNavigationAreaComponent::OnStartPlayInEditorBegin()
-    {
-        m_switchingToGameMode = true;
-    }
-
-    void EditorNavigationAreaComponent::OnEntityCompositionChanging(const AzToolsFramework::EntityIdList& entityIds)
-    {
-        if (AZStd::find(entityIds.begin(), entityIds.end(), GetEntityId()) != entityIds.end())
-        {
-            m_compositionChanging = true;
-        }
-    }
-
-    void EditorNavigationAreaComponent::OnEntityCompositionChanged(const AzToolsFramework::EntityIdList& entityIds)
-    {
-        if (AZStd::find(entityIds.begin(), entityIds.end(), GetEntityId()) != entityIds.end())
-        {
-            m_compositionChanging = false;
-        }
-    }
-
-    void EditorNavigationAreaComponent::OnTick(float /*deltaTime*/, AZ::ScriptTimePoint /*time*/)
-    {
-        m_compositionChanging = false;
-
-        // disconnect from the composition and tick bus because we no longer need to
-        // be concerned with entity scrubbing causing our navigation area to get rebuilt
-        AzToolsFramework::EntityCompositionNotificationBus::Handler::BusDisconnect();
-        AZ::TickBus::Handler::BusDisconnect();
-    }
-
-} // namespace LmbrCentral

+ 0 - 123
Gems/LmbrCentral/Code/Source/Ai/EditorNavigationAreaComponent.h

@@ -1,123 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-#include <AzCore/Component/TransformBus.h>
-#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
-#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
-#include <AzToolsFramework/API/EntityCompositionNotificationBus.h>
-#include <LmbrCentral/Shape/ShapeComponentBus.h>
-#include <LmbrCentral/Ai/NavigationAreaBus.h>
-#include <AzCore/Component/TickBus.h>
-
-// ISerialize.h required by INavigationSystem.h
-#include <ISerialize.h>
-#include <INavigationSystem.h>
-
-namespace AZ
-{
-    class PolygonPrism;
-    class SerializeContext;
-    class Vector3;
-}
-
-namespace LmbrCentral
-{
-    /**
-     * EditorNavigationAreaComponent makes use of PolygonPrismShape to construct a volume to generate
-     * a Nav Mesh for the terrain to be used by AI characters for navigation.
-     */
-    class EditorNavigationAreaComponent
-        : public AzToolsFramework::Components::EditorComponentBase
-        , public INavigationSystem::INavigationSystemListener
-        , private ShapeComponentNotificationsBus::Handler
-        , private AZ::TransformNotificationBus::Handler
-        , private NavigationAreaRequestBus::Handler
-        , private AzToolsFramework::EditorEntityContextNotificationBus::Handler
-        , private AzToolsFramework::EntityCompositionNotificationBus::Handler
-        , private AZ::TickBus::Handler
-    {
-    public:
-        AZ_COMPONENT(EditorNavigationAreaComponent, "{8391FF77-7F4E-4576-9617-37793F88C5DA}", AzToolsFramework::Components::EditorComponentBase);
-
-        EditorNavigationAreaComponent();
-        ~EditorNavigationAreaComponent() override;
-
-    protected:
-        // AZ::Component
-        void Activate() override;
-        void Deactivate() override;
-
-    private:
-        // ShapeComponentNotificationsBus::Handler
-        void OnShapeChanged(ShapeChangeReasons changeReason) override;
-
-        // TransformNotificationBus
-        void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
-        // NavigationAreaRequestBus
-        void RefreshArea() override;
-
-        // INavigationSystemListener
-        void OnNavigationEvent(const INavigationSystem::ENavigationEvent event) override;
-
-        // EditorNavigationAreaComponent
-        void UpdateGameArea();
-        void RelinkWithMesh(bool updateGameArea);
-        void UpdateMeshes();
-        void ApplyExclusion();
-        void DestroyVolume();
-        void DestroyMeshes();
-        void CreateVolume(AZ::Vector3* vertices, size_t vertexCount, NavigationVolumeID requestedID);
-        void DestroyArea();
-        
-        // EditorEntityContextNotificationBus
-        void OnStartPlayInEditorBegin() override;
-
-        // EntityCompositionNotificationBus 
-        void OnEntityCompositionChanging(const AzToolsFramework::EntityIdList& entityIds) override;
-        void OnEntityCompositionChanged(const AzToolsFramework::EntityIdList& entityIds) override;
-
-        // TickBus
-        void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
-
-        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
-        {
-            provided.push_back(AZ_CRC("NavigationAreaService", 0xd6ec6566));
-        }
-
-        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
-        {
-            required.push_back(AZ_CRC("PolygonPrismShapeService", 0x1cbc4ed4));
-        }
-
-        static void Reflect(AZ::ReflectContext* context);
-
-        /**
-         * Called when editor property grid values are modified to ensure navigation area updates correctly.
-         */
-        void OnNavigationAreaChanged() const
-        {
-            if (m_navigationAreaChanged)
-            {
-                m_navigationAreaChanged();
-            }
-        }
-
-        AZStd::vector<AZStd::string> m_agentTypes; ///< Define a list of AgentTypes corresponding to those defined in Scripts/AI/Navigation.xml.
-        AZStd::vector<AZ::u32> m_meshes; ///< NavigationMeshID - vector of mesh ids for each AgentType.
-        AZStd::string m_name; ///< Name used to register volume (currently Entity name).
-        AZ::u32 m_volume = 0; ///< NavigationVolumeID - id of created nav mesh volume.
-        bool m_exclusion = false; ///< Is this area an exclusion volume or not (should it add or subtract from the nav mesh).
-        AZStd::function<void()> m_navigationAreaChanged = nullptr; ///< Callback when the navigation area is modified.
-
-        bool m_switchingToGameMode = false; ///< Set if GameView was started so we know not to destroy navigation areas in Deactivate.
-        bool m_compositionChanging = false; ///< Set if composition is changing so we know not to destroy navigation areas while scrubbing.
-    };
-} // namespace LmbrCentral

+ 0 - 99
Gems/LmbrCentral/Code/Source/Ai/EditorNavigationSeedComponent.cpp

@@ -1,99 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#include "EditorNavigationSeedComponent.h"
-#include "EditorNavigationUtil.h"
-
-// Cry pathfinding system
-#include <INavigationSystem.h>
-#include <MathConversion.h>
-
-#include <AzCore/Component/TransformBus.h>
-#include <AzCore/Serialization/SerializeContext.h>
-#include <AzCore/Serialization/EditContext.h>
-
-namespace LmbrCentral
-{
-    void EditorNavigationSeedComponent::Reflect(AZ::ReflectContext* context)
-    {
-        if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
-        {
-            serializeContext->Class<EditorNavigationSeedComponent, AzToolsFramework::Components::EditorComponentBase>()
-                ->Version(1)
-                ->Field("Agent Type", &EditorNavigationSeedComponent::m_agentType);
-
-            if (auto editContext = serializeContext->GetEditContext())
-            {
-                editContext->Class<EditorNavigationSeedComponent>("Navigation Seed", "Determines reachable navigation nodes")
-                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
-                        ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
-                        ->Attribute(AZ::Edit::Attributes::AddableByUser, false)
-                        ->Attribute(AZ::Edit::Attributes::Category, "AI")
-                        ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/NavigationSeed.svg")
-                        ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/NavigationSeed.svg")
-                        ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-                        ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/ai/nav-seed/")
-                    ->DataElement(AZ::Edit::UIHandlers::ComboBox, &EditorNavigationSeedComponent::m_agentType, "Agent Type", "Describes the type of the Entity for navigation purposes.")
-                        ->Attribute(AZ::Edit::Attributes::StringList, &PopulateAgentTypeList)
-                        ->Attribute("ChangeNotify", &EditorNavigationSeedComponent::OnAgentTypeChanged);
-            }
-        }
-    }
-
-    void EditorNavigationSeedComponent::TriggerReachaibilityRecalculation() const
-    {
-        // We have to call the legacy method to account for Legacy seeds that might be out there
-        INavigationSystem* navigationSystem = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (navigationSystem)
-        {
-            navigationSystem->CalculateAccessibility();
-        }
-    }
-
-    AZ::u32 EditorNavigationSeedComponent::OnAgentTypeChanged() const
-    {
-        TriggerReachaibilityRecalculation();
-        return AZ_CRC("RefreshNone", 0x98a5045b);
-    }
-
-    void EditorNavigationSeedComponent::RecalculateReachabilityAroundSelf()
-    {
-        AZ::Vector3 translation = AZ::Vector3::CreateZero();
-        AZ::TransformBus::EventResult(translation, m_entity->GetId(), &AZ::TransformInterface::GetWorldTranslation);
-        
-        INavigationSystem* navigationSystem = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (navigationSystem)
-        {
-            auto agentType = navigationSystem->GetAgentTypeID(m_agentType.c_str());
-            navigationSystem->ComputeAccessibility(AZVec3ToLYVec3(translation), agentType);
-        }
-    }
-
-    void EditorNavigationSeedComponent::OnTransformChanged(const AZ::Transform&, const AZ::Transform&)
-    {
-        TriggerReachaibilityRecalculation();
-    }
-
-    void EditorNavigationSeedComponent::Activate()
-    {
-        Base::Activate();
-
-        NavigationSeedRequestsBus::Handler::BusConnect();
-        AZ::TransformNotificationBus::Handler::BusConnect(m_entity->GetId());
-
-        TriggerReachaibilityRecalculation();
-    }
-
-    void EditorNavigationSeedComponent::Deactivate()
-    {
-        Base::Deactivate();
-
-        NavigationSeedRequestsBus::Handler::BusDisconnect();
-        AZ::TransformNotificationBus::Handler::BusDisconnect(m_entity->GetId());
-    }
-} // LmbrCentral

+ 0 - 46
Gems/LmbrCentral/Code/Source/Ai/EditorNavigationSeedComponent.h

@@ -1,46 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
-#include <AzCore/Component/TransformBus.h>
-#include <LmbrCentral/Ai/NavigationSeedBus.h>
-
-namespace LmbrCentral
-{
-    class EditorNavigationSeedComponent
-        : public AzToolsFramework::Components::EditorComponentBase
-        , private NavigationSeedRequestsBus::Handler
-        , private AZ::TransformNotificationBus::Handler
-    {
-        using Base = AzToolsFramework::Components::EditorComponentBase;
-
-    public:
-        AZ_EDITOR_COMPONENT(EditorNavigationSeedComponent, "{A836E9F7-0C5A-4397-AD01-523EBC1E41A5}");
-        EditorNavigationSeedComponent() = default;
-
-    protected:
-        void Activate() override;
-        void Deactivate() override;
-
-        static void Reflect(AZ::ReflectContext* context);
-
-    private:
-        AZStd::string m_agentType;
-
-        void TriggerReachaibilityRecalculation() const;
-        AZ::u32 OnAgentTypeChanged() const;
-
-        // NavigationSeedRequestBus
-        void RecalculateReachabilityAroundSelf() override;
-
-        // TransformNotificationBus
-        void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-    };
-} // namespace LmbrCentral

+ 0 - 23
Gems/LmbrCentral/Code/Source/Ai/EditorNavigationUtil.cpp

@@ -1,23 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#include "EditorNavigationUtil.h"
-
-#include <AzToolsFramework/API/ToolsApplicationAPI.h>
-
-namespace LmbrCentral
-{
-    AZStd::vector<AZStd::string> PopulateAgentTypeList()
-    {
-        AZStd::vector<AZStd::string> agentTypes;
-        AzToolsFramework::EditorRequests::Bus::BroadcastResult(
-            agentTypes, &AzToolsFramework::EditorRequests::Bus::Events::GetAgentTypes);
-        agentTypes.insert(agentTypes.begin(), ""); // insert blank element
-        return agentTypes;
-    }
-} // namespace LmbrCentral

+ 0 - 20
Gems/LmbrCentral/Code/Source/Ai/EditorNavigationUtil.h

@@ -1,20 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-
-#pragma once
-
-#include <AzCore/std/string/string.h>
-#include <AzCore/std/containers/vector.h>
-
-namespace LmbrCentral
-{
-    /**
-     * Request available AgentTypes to populate ComboBox drop down.
-     */
-    AZStd::vector<AZStd::string> PopulateAgentTypeList();
-}

+ 0 - 882
Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.cpp

@@ -1,882 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#include "NavigationComponent.h"
-#include "EditorNavigationUtil.h"
-
-#include <IPathfinder.h>
-#include <MathConversion.h>
-#include <AzCore/Serialization/EditContext.h>
-#include <AzCore/Serialization/SerializeContext.h>
-#include <AzFramework/Physics/RigidBodyBus.h>
-#include <AzFramework/Physics/CharacterBus.h>
-#include <AzFramework/Physics/PhysicsScene.h>
-#include <AzFramework/Physics/Common/PhysicsTypes.h>
-#include <AzCore/RTTI/BehaviorContext.h>
-#include <AzCore/Interface/Interface.h>
-#ifdef LMBR_CENTRAL_EDITOR
-#include <AzToolsFramework/API/ToolsApplicationAPI.h>
-#endif
-
-namespace LmbrCentral
-{
-    // Behavior Context forwarder for NavigationComponentNotificationBus
-    class BehaviorNavigationComponentNotificationBusHandler : public NavigationComponentNotificationBus::Handler, public AZ::BehaviorEBusHandler
-    {
-    public:
-        AZ_EBUS_BEHAVIOR_BINDER_WITH_DOC(BehaviorNavigationComponentNotificationBusHandler,"{6D060202-06BA-470E-8F6B-E1982360C752}",AZ::SystemAllocator
-            , OnSearchingForPath, ({"RequestId","Navigation request Id"})
-            , OnTraversalStarted, ({"RequestId","Navigation request Id"})
-            , OnTraversalPathUpdate, ({"RequestId","Navigation request Id"},{"NextPathPosition","Next path position"},{"InflectionPosition","Next inflection position"})
-            , OnTraversalInProgress, ({"RequestId","Navigation request Id"},{"Distance","Distance remaining"})
-            , OnTraversalComplete, ({"RequestId","Navigation request Id"})
-            , OnTraversalCancelled, ({"RequestId","Navigation request Id"}));
-
-        void OnSearchingForPath(PathfindRequest::NavigationRequestId requestId) override
-        {
-            Call(FN_OnSearchingForPath, requestId);
-        }
-
-        void OnTraversalStarted(PathfindRequest::NavigationRequestId requestId) override
-        {
-            Call(FN_OnTraversalStarted, requestId);
-        }
-
-        void OnTraversalPathUpdate(PathfindRequest::NavigationRequestId requestId, const AZ::Vector3& nextPathPosition, const AZ::Vector3& inflectionPosition) override
-        {
-            Call(FN_OnTraversalPathUpdate, requestId, nextPathPosition, inflectionPosition);
-        }
-
-        void OnTraversalInProgress(PathfindRequest::NavigationRequestId requestId, float distanceRemaining) override
-        {
-            Call(FN_OnTraversalInProgress, requestId, distanceRemaining);
-        }
-
-        void OnTraversalComplete(PathfindRequest::NavigationRequestId requestId) override
-        {
-            Call(FN_OnTraversalComplete, requestId);
-        }
-
-        void OnTraversalCancelled(PathfindRequest::NavigationRequestId requestId) override
-        {
-            Call(FN_OnTraversalCancelled, requestId);
-        }
-    };
-
-
-    PathfindRequest::NavigationRequestId PathfindResponse::s_nextRequestId = kInvalidRequestId;
-
-    //////////////////////////////////////////////////////////////////////////
-
-    //=========================================================================
-    bool NavigationComponentVersionConverter(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
-    {
-        if (classElement.GetVersion() < 4)
-        {
-            // "Move Physically" changed to "Movement Method"
-            constexpr const char* movePhysicallyName = "Move Physically";
-            constexpr const char* movementMethodName = "Movement Method";
-            int movePhysicallyIndex = classElement.FindElement(AZ_CRC(movePhysicallyName));
-            if (movePhysicallyIndex != -1)
-            {
-                bool movePhysically = false;
-                classElement.GetSubElement(movePhysicallyIndex).GetData(movePhysically);
-                classElement.RemoveElement(movePhysicallyIndex);
-
-                if (movePhysically)
-                {
-                    classElement.AddElementWithData(context, movementMethodName, NavigationComponentRequests::MovementMethod::Physics);
-                }
-                else
-                {
-                    classElement.AddElementWithData(context, movementMethodName, NavigationComponentRequests::MovementMethod::Transform);
-                }
-            }
-        }
-
-        return true;
-    }
-
-    void NavigationComponent::Reflect(AZ::ReflectContext* context)
-    {
-        if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
-        {
-            serializeContext->Class<NavigationComponent, AZ::Component>()
-                ->Version(4, &NavigationComponentVersionConverter)
-                ->Field("Agent Type", &NavigationComponent::m_agentType)
-                ->Field("Agent Speed", &NavigationComponent::m_agentSpeed)
-                ->Field("Agent Radius", &NavigationComponent::m_agentRadius)
-                ->Field("Arrival Distance Threshold", &NavigationComponent::m_arrivalDistanceThreshold)
-                ->Field("Repath Threshold", &NavigationComponent::m_repathThreshold)
-                ->Field("Movement Method", &NavigationComponent::m_movementMethod)
-                ->Field("Allow Vertical Navigation", &NavigationComponent::m_allowVerticalNavigation);
-
-            if (AZ::EditContext* editContext = serializeContext->GetEditContext())
-            {
-                editContext->Class<NavigationComponent>(
-                    "Navigation", "The Navigation component provides basic pathfinding and pathfollowing services to an entity")
-                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
-                    ->Attribute(AZ::Edit::Attributes::AddableByUser, false)
-                    ->Attribute(AZ::Edit::Attributes::Category, "AI")
-                    ->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Navigation.svg")
-                    ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Navigation.svg")
-                    ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
-                    ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-                    ->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://o3de.org/docs/user-guide/components/reference/ai/navigation/")
-                    ->DataElement(AZ::Edit::UIHandlers::Default, &NavigationComponent::m_agentSpeed, "Agent Speed",
-                        "The speed of the agent while navigating ")
-                    ->DataElement(AZ::Edit::UIHandlers::ComboBox, &NavigationComponent::m_agentType, "Agent Type",
-                        "Describes the type of the Entity for navigation purposes. ")
-#ifdef LMBR_CENTRAL_EDITOR
-                    ->Attribute(AZ::Edit::Attributes::StringList, &NavigationComponent::PopulateAgentTypeList)
-                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &NavigationComponent::HandleAgentTypeChanged)
-#endif
-
-                    ->DataElement(AZ::Edit::UIHandlers::Default, &NavigationComponent::m_agentRadius, "Agent Radius",
-                        "Radius of this Navigation Agent")
-                    ->Attribute(AZ::Edit::Attributes::ReadOnly, true)
-                    ->Attribute("Suffix", " m")
-
-                    ->DataElement(AZ::Edit::UIHandlers::Default, &NavigationComponent::m_arrivalDistanceThreshold,
-                        "Arrival Distance Threshold", "Describes the distance from the end point that an entity needs to be before its movement is to be stopped and considered complete")
-                    ->Attribute("Suffix", " m")
-
-                    ->DataElement(AZ::Edit::UIHandlers::Default, &NavigationComponent::m_repathThreshold,
-                        "Repath Threshold", "Describes the distance from its previously known location that a target entity needs to move before a new path is calculated")
-                    ->Attribute("Suffix", " m")
-
-                    ->DataElement(AZ::Edit::UIHandlers::ComboBox, &NavigationComponent::m_movementMethod,
-                        "Movement Method", "Indicates the method used to move the entity, the default 'Transform' method will modify the position using the TransformBus")
-                    ->Attribute(AZ::Edit::Attributes::EnumValues,
-                        AZStd::vector<AZ::Edit::EnumConstant<NavigationComponentRequests::MovementMethod>>
-                        {
-                            AZ::Edit::EnumConstant<NavigationComponentRequests::MovementMethod>(NavigationComponentRequests::MovementMethod::Transform,
-                                "Transform"),
-                                AZ::Edit::EnumConstant<NavigationComponentRequests::MovementMethod>(NavigationComponentRequests::MovementMethod::Physics,
-                                "Physics"),
-                                AZ::Edit::EnumConstant<NavigationComponentRequests::MovementMethod>(NavigationComponentRequests::MovementMethod::Custom,
-                                "Custom")
-                        })
-
-                    ->DataElement(AZ::Edit::UIHandlers::CheckBox, &NavigationComponent::m_allowVerticalNavigation,
-                        "Allow Vertical Navigation", "Indicates whether vertical navigation is allowed or if navigation is constrained to the X and Y plane");
-
-            }
-        }
-
-        if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
-        {
-            behaviorContext->EBus<NavigationComponentRequestBus>("NavigationComponentRequestBus")
-                ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
-                ->Attribute(AZ::Script::Attributes::Category, "Navigation")
-                ->Attribute(AZ::Script::Attributes::Module, "navigation")
-                ->Event("FindPathToEntity", &NavigationComponentRequestBus::Events::FindPathToEntity, { { {"EntityId","The entity to follow"} } })
-                ->Event("FindPathToPosition", &NavigationComponentRequestBus::Events::FindPathToPosition, { { {"Position","The position to navigate to"} } })
-                ->Event("Stop", &NavigationComponentRequestBus::Events::Stop, { { {"RequestId","The request Id of the navigation process to stop"} } })
-                ->Event("GetAgentSpeed", &NavigationComponentRequestBus::Events::GetAgentSpeed)
-                ->Event("SetAgentSpeed", &NavigationComponentRequestBus::Events::SetAgentSpeed, { { {"Speed","The agent speed in meters per second"} } })
-                ->Event("GetAgentMovementMethod", &NavigationComponentRequestBus::Events::GetAgentMovementMethod)
-                ->Event("SetAgentMovementMethod", &NavigationComponentRequestBus::Events::SetAgentMovementMethod, { { {"Method","The movement method: Transform, Physics or Custom"} } });
-
-            behaviorContext->EBus<NavigationComponentNotificationBus>("NavigationComponentNotificationBus")
-                ->Handler<BehaviorNavigationComponentNotificationBusHandler>();
-        }
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-
-    //////////////////////////////////////////////////////////////////////////
-    // Pathfind response
-    //! @param navComponent The navigation component being serviced by this response
-    PathfindResponse::PathfindResponse()
-        : m_requestId(kInvalidRequestId)
-        , m_pathfinderRequestId(kInvalidRequestId)
-        , m_responseStatus(PathfindResponse::Status::Uninitialized)
-        , m_navigationComponent(nullptr)
-        , m_previousAgentVelocity(AZ::Vector3::CreateZero())
-        , m_pathFollower(nullptr)
-        , m_nextPathPosition(AZ::Vector3::CreateZero())
-        , m_inflectionPosition(AZ::Vector3::CreateZero())
-    {
-    }
-
-    void PathfindResponse::SetupForNewRequest(NavigationComponent* ownerComponent, const PathfindRequest& request)
-    {
-        AZ_Assert(ownerComponent, "Invalid parent component.");
-
-        m_navigationComponent = ownerComponent;
-        m_request = request;
-        m_requestId = ++s_nextRequestId;
-        m_currentDestination = request.GetDestinationLocation();
-        m_previousAgentVelocity = AZ::Vector3::CreateZero();
-
-        // Reset State information
-        m_pathfinderRequestId = kInvalidRequestId;
-        m_currentPath.reset();
-
-        // Setup pathfollower instance.
-        PathFollowerParams params;
-        params.endAccuracy = m_navigationComponent->GetArrivalDistance();
-        params.normalSpeed = m_navigationComponent->GetAgentSpeed();
-        params.passRadius = m_navigationComponent->GetAgentRadius();
-        params.minSpeed = params.normalSpeed * 0.8f;
-        params.maxSpeed = params.normalSpeed * 1.2f;
-        params.stopAtEnd = true;
-        params.use2D = !m_navigationComponent->GetAllowVerticalNavigation();
-        m_pathFollower = nullptr;
-
-        // Disconnect from any notifications from earlier requests
-        AZ::TransformNotificationBus::Handler::BusDisconnect();
-        AZ::EntityBus::Handler::BusDisconnect();
-
-        SetStatus(Status::Initialized);
-
-        // If this request is to follow a moving entity then connect to the transform notification bus for the target
-        if (m_request.HasTargetEntity())
-        {
-            SetStatus(Status::WaitingForTargetEntity);
-            AZ::TransformNotificationBus::Handler::BusConnect(m_request.GetTargetEntityId());
-            AZ::EntityBus::Handler::BusConnect(m_request.GetTargetEntityId());
-        }
-    }
-
-    void PathfindResponse::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
-    {
-        if (!m_navigationComponent)
-        {
-            return;
-        }
-
-        if ((m_responseStatus == Status::TraversalStarted) || (m_responseStatus == Status::TraversalInProgress))
-        {
-            auto delta = (world.GetTranslation() - GetCurrentDestination()).GetLength();
-
-            if (delta > m_navigationComponent->m_repathThreshold)
-            {
-                m_currentDestination = world.GetTranslation();
-                SetPathfinderRequestId(m_navigationComponent->RequestPath());
-            }
-        }
-    }
-
-    void PathfindResponse::OnEntityActivated(const AZ::EntityId&)
-    {
-        // Get the target entity's position
-        AZ::Transform entityTransform = AZ::Transform::CreateIdentity();
-        AZ::TransformBus::EventResult(entityTransform, m_request.GetTargetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
-        m_currentDestination = entityTransform.GetTranslation();
-
-        if (m_responseStatus == Status::WaitingForTargetEntity)
-        {
-            AZ::EntityBus::Handler::BusDisconnect();
-            m_navigationComponent->FindPathImpl();
-        }
-    }
-
-    void PathfindResponse::OnEntityDeactivated(const AZ::EntityId&)
-    {
-        AZ::EntityBus::Handler::BusDisconnect();
-    }
-
-    void PathfindResponse::SetOwningComponent(NavigationComponent* navComponent)
-    {
-        m_navigationComponent = navComponent;
-    }
-
-    const PathfindRequest& PathfindResponse::GetRequest() const
-    {
-        return m_request;
-    }
-
-    PathfindRequest::NavigationRequestId PathfindResponse::GetRequestId() const
-    {
-        return m_requestId;
-    }
-
-    PathfindResponse::PathfinderRequestId PathfindResponse::GetPathfinderRequestId() const
-    {
-        return m_pathfinderRequestId;
-    }
-
-    void PathfindResponse::SetPathfinderRequestId(PathfinderRequestId pathfinderRequestId)
-    {
-        m_pathfinderRequestId = pathfinderRequestId;
-    }
-
-    const AZ::Vector3& PathfindResponse::GetCurrentDestination() const
-    {
-        return m_currentDestination;
-    }
-
-    PathfindResponse::Status PathfindResponse::GetStatus() const
-    {
-        return m_responseStatus;
-    }
-
-    void PathfindResponse::SetStatus(Status status)
-    {
-        m_responseStatus = status;
-
-        // If the traversal was cancelled or completed and the request was following an entity
-        if ((status >= Status::TraversalComplete) && m_request.HasTargetEntity())
-        {
-            // Disconnect from any notifications on the transform bust
-            AZ::TransformNotificationBus::Handler::BusDisconnect();
-        }
-    }
-
-    void PathfindResponse::SetCurrentPath(const INavPathPtr& currentPath)
-    {
-        m_currentPath = currentPath;
-
-        if (m_pathFollower)
-        {
-            m_pathFollower->AttachToPath(m_currentPath.get());
-        }
-    }
-
-    INavPathPtr PathfindResponse::GetCurrentPath()
-    {
-        return m_currentPath;
-    }
-
-    void PathfindResponse::Reset()
-    {
-        PathfindResponse::Status lastResponseStatus = GetStatus();
-
-        // If there is already a Request being serviced
-        if (lastResponseStatus > PathfindResponse::Status::Initialized
-            && lastResponseStatus < PathfindResponse::Status::TraversalComplete)
-        {
-            // If the pathfinding request was still being serviced by the pathfinder
-            if (lastResponseStatus >= PathfindResponse::Status::SearchingForPath
-                && lastResponseStatus <= PathfindResponse::Status::TraversalInProgress)
-            {
-                // and If the request was a valid one
-                if (GetRequestId() != PathfindResponse::kInvalidRequestId)
-                {
-                    // Cancel that request with the pathfinder
-                    IMNMPathfinder* pathFinder = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-                    if (pathFinder)
-                    {
-                        pathFinder->CancelPathRequest(GetPathfinderRequestId());
-                    }
-                }
-            }
-
-            // Indicate that traversal on this request was cancelled
-            SetStatus(PathfindResponse::Status::TraversalCancelled);
-
-            // Inform every listener on this entity that traversal was cancelled.
-            NavigationComponentNotificationBus::Event(m_navigationComponent->GetEntityId(),
-                &NavigationComponentNotificationBus::Events::OnTraversalCancelled, GetRequestId());
-        }
-
-        m_pathFollower.reset();
-    }
-
-    const AZ::Vector3& PathfindResponse::GetLastKnownAgentVelocity() const
-    {
-        return m_previousAgentVelocity;
-    }
-
-    void PathfindResponse::SetLastKnownAgentVelocity(const AZ::Vector3& newVelocity)
-    {
-        m_previousAgentVelocity = newVelocity;
-    }
-
-    const AZ::Vector3& PathfindResponse::GetNextPathPosition() const
-    {
-        return m_nextPathPosition;
-    }
-
-    void PathfindResponse::SetNextPathPosition(const AZ::Vector3& newPosition)
-    {
-        m_nextPathPosition = newPosition;
-    }
-
-    const AZ::Vector3& PathfindResponse::GetInflectionPosition() const
-    {
-        return m_inflectionPosition;
-    }
-
-    void PathfindResponse::SetInflectionPosition(const AZ::Vector3& newPosition)
-    {
-        m_inflectionPosition = newPosition;
-    }
-
-    IPathFollowerPtr PathfindResponse::GetPathFollower()
-    {
-        return m_pathFollower;
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-
-    NavigationComponent::NavigationComponent()
-        : m_agentSpeed(1.f)
-        , m_agentRadius(4.f)
-        , m_arrivalDistanceThreshold(0.25f)
-        , m_repathThreshold(1.f)
-        , m_movementMethod(NavigationComponentRequests::MovementMethod::Physics)
-        , m_usesCharacterPhysics(false)
-        , m_allowVerticalNavigation(false)
-        , m_sceneStartSimHandler([this](
-            [[maybe_unused]] AzPhysics::SceneHandle sceneHandle,
-            float fixedDeltatime
-            )
-            {
-                this->MoveEntity(fixedDeltatime);
-            }, aznumeric_cast<int32_t>(AzPhysics::SceneEvents::PhysicsStartFinishSimulationPriority::Components))
-    {
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // AZ::Component interface implementation
-    void NavigationComponent::Init()
-    {
-        m_lastResponseCache.SetOwningComponent(this);
-        const INavigationSystem* navigationSystem = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (navigationSystem)
-        {
-            m_agentTypeId = navigationSystem->GetAgentTypeID(m_agentType.c_str());
-        }
-    }
-
-    void NavigationComponent::Activate()
-    {
-        const AZ::EntityId& entityId = GetEntityId();
-
-        NavigationComponentRequestBus::Handler::BusConnect(entityId);
-        AZ::TransformNotificationBus::Handler::BusConnect(entityId);
-
-        if (m_movementMethod == NavigationComponentRequests::MovementMethod::Physics)
-        {
-            bool usesLegacyCharacterPhysics = false;
-
-
-            const bool usesAZCharacterPhysics = Physics::CharacterRequestBus::FindFirstHandler(entityId) != nullptr;
-            m_usesCharacterPhysics = usesLegacyCharacterPhysics || usesAZCharacterPhysics;
-
-            AZ_Warning("NavigationComponent",
-                usesAZCharacterPhysics || Physics::RigidBodyRequestBus::FindFirstHandler(entityId),
-                "Entity %s cannot be moved physically because it is missing a physics component", GetEntity()->GetName().c_str());
-        }
-
-        AZ::TransformBus::EventResult(m_entityTransform, entityId, &AZ::TransformBus::Events::GetWorldTM);
-    }
-
-    void NavigationComponent::Deactivate()
-    {
-        NavigationComponentRequestBus::Handler::BusDisconnect();
-        AZ::TransformNotificationBus::Handler::BusDisconnect();
-
-        Reset();
-    }
-#ifdef LMBR_CENTRAL_EDITOR
-    float NavigationComponent::CalculateAgentNavigationRadius(const char* agentTypeName)
-    {
-        float agentRadius = -1.0f;
-        AzToolsFramework::EditorRequests::Bus::BroadcastResult(
-            agentRadius, &AzToolsFramework::EditorRequests::Bus::Events::CalculateAgentNavigationRadius
-            , agentTypeName);
-
-        return agentRadius;
-    }
-
-    const char* NavigationComponent::GetDefaultAgentNavigationTypeName()
-    {
-        const char* agentTypeName = "";
-        AzToolsFramework::EditorRequests::Bus::BroadcastResult(
-            agentTypeName, &AzToolsFramework::EditorRequests::Bus::Events::GetDefaultAgentNavigationTypeName);
-
-        return agentTypeName;
-    }
-
-    AZStd::vector<AZStd::string> NavigationComponent::PopulateAgentTypeList()
-    {
-        if (m_agentType.size() == 0)
-        {
-            // If no previously stored agent type select a default one (usually on component added)
-            m_agentType = GetDefaultAgentNavigationTypeName();
-        }
-        HandleAgentTypeChanged();
-        return LmbrCentral::PopulateAgentTypeList();
-    }
-
-    AZ::u32 NavigationComponent::HandleAgentTypeChanged()
-    {
-        float agentRadius = CalculateAgentNavigationRadius(m_agentType.c_str());
-        if (agentRadius >= 0.0f)
-        {
-            m_agentRadius = agentRadius;
-        }
-        else
-        {
-            AZ_Error("Editor", false, "Unable to find navigation radius data for agent type '%s'", m_agentType.c_str());
-        }
-        return AZ::Edit::PropertyRefreshLevels::ValuesOnly;
-    }
-#endif
-    //////////////////////////////////////////////////////////////////////////
-
-    //////////////////////////////////////////////////////////////////////////
-    // NavigationComponentRequestBus::Handler interface implementation
-
-    PathfindRequest::NavigationRequestId NavigationComponent::FindPath(const PathfindRequest& request)
-    {
-        // If neither the position nor the destination has been set
-        if (!(request.HasTargetEntity() || request.HasTargetLocation()))
-        {
-            // Return an invalid id to indicate that the request is bad
-            return PathfindResponse::kInvalidRequestId;
-        }
-
-        // Reset the Navigation component to deal with a new pathfind request
-        Reset();
-
-        m_lastResponseCache.SetupForNewRequest(this, request);
-
-        if (!request.HasTargetEntity())
-        {
-            FindPathImpl();
-        }
-
-        return m_lastResponseCache.GetRequestId();
-    }
-
-    void NavigationComponent::FindPathImpl()
-    {
-        // Request for a path
-        PathfindResponse::PathfinderRequestId pathfinderRequestID = RequestPath();
-        m_lastResponseCache.SetPathfinderRequestId(pathfinderRequestID);
-
-        if (pathfinderRequestID != MNM::Constants::eQueuedPathID_InvalidID)
-        {
-            // Indicate that the path is being looked for
-            m_lastResponseCache.SetStatus(PathfindResponse::Status::SearchingForPath);
-
-            // Inform every listener on this entity about the "Searching For Path" event
-            NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                &NavigationComponentNotificationBus::Events::OnSearchingForPath, m_lastResponseCache.GetRequestId());
-        }
-        else
-        {
-            m_lastResponseCache.SetStatus(PathfindResponse::Status::TraversalCancelled);
-
-            // Inform every listener on this entity about the "Traversal cancelled" event
-            NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                &NavigationComponentNotificationBus::Events::OnTraversalCancelled, m_lastResponseCache.GetRequestId());
-        }
-    }
-
-    PathfindResponse::PathfinderRequestId NavigationComponent::RequestPath()
-    {
-        // Create a new pathfind request
-        MNMPathRequest pathfinderRequest;
-
-        // 1. Set the current entity's position as the start location
-        pathfinderRequest.startLocation = AZVec3ToLYVec3(m_entityTransform.GetTranslation());
-
-        // 2. Set the requested destination
-        pathfinderRequest.endLocation = AZVec3ToLYVec3(m_lastResponseCache.GetCurrentDestination());
-
-        // 3. Set the type of the Navigation agent
-        pathfinderRequest.agentTypeID = m_agentTypeId;
-
-        // 4. Set the callback
-        pathfinderRequest.resultCallback = AZStd::bind(&NavigationComponent::OnPathResult, this,
-                                                        AZStd::placeholders::_1, AZStd::placeholders::_2);
-
-        // 5. Request the path.
-        IMNMPathfinder* pathFinder = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        return pathFinder ? pathFinder->RequestPathTo(this, pathfinderRequest) : 0;
-    }
-
-    void NavigationComponent::OnPathResult(const MNM::QueuedPathID& pathfinderRequestId, MNMPathRequestResult& result)
-    {
-        // If the pathfinding result is for the latest pathfinding request (Otherwise ignore)
-        if (pathfinderRequestId == m_lastResponseCache.GetPathfinderRequestId())
-        {
-            if (result.HasPathBeenFound() &&
-                (m_lastResponseCache.GetRequestId() != PathfindResponse::kInvalidRequestId))
-            {
-                m_lastResponseCache.SetCurrentPath(result.pPath->Clone());
-
-                // If this request was in fact looking for a path (and this isn't just a path update request)
-                if (m_lastResponseCache.GetStatus() == PathfindResponse::Status::SearchingForPath)
-                {
-                    // Set the status of this request
-                    m_lastResponseCache.SetStatus(PathfindResponse::Status::PathFound);
-
-                    // Inform every listener on this entity that a path has been found
-                    bool shouldPathBeTraversed = true;
-
-                    NavigationComponentNotificationBus::EventResult(shouldPathBeTraversed, m_entity->GetId(),
-                        &NavigationComponentNotificationBus::Events::OnPathFound, m_lastResponseCache.GetRequestId(),
-                        m_lastResponseCache.GetCurrentPath());
-
-                    if (shouldPathBeTraversed)
-                    {
-                        // Connect to physics bus if appropriate, else tick bus
-                        if ((m_movementMethod == NavigationComponentRequests::MovementMethod::Physics))
-                        {
-                            if (auto* sceneInterface = AZ::Interface<AzPhysics::SceneInterface>::Get())
-                            {
-                                AzPhysics::SceneHandle sceneHandle = sceneInterface->GetSceneHandle(AzPhysics::DefaultPhysicsSceneName);
-                                sceneInterface->RegisterSceneSimulationStartHandler(sceneHandle, m_sceneStartSimHandler);
-                            }
-                        }
-                        else
-                        {
-                            AZ::TickBus::Handler::BusConnect();
-                        }
-
-                        //  Set the status of this request
-                        m_lastResponseCache.SetStatus(PathfindResponse::Status::TraversalStarted);
-
-                        // Inform every listener on this entity that traversal is in progress
-                        NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                            &NavigationComponentNotificationBus::Events::OnTraversalStarted,
-                            m_lastResponseCache.GetRequestId());
-                    }
-                    else
-                    {
-                        // Set the status of this request
-                        m_lastResponseCache.SetStatus(PathfindResponse::Status::TraversalCancelled);
-
-                        // Inform every listener on this entity that a path could not be found
-                        NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                        &NavigationComponentNotificationBus::Events::OnTraversalCancelled,
-                        m_lastResponseCache.GetRequestId());
-                    }
-                }
-            }
-            else
-            {
-                // Set the status of this request
-                m_lastResponseCache.SetStatus(PathfindResponse::Status::TraversalCancelled);
-
-                // Inform every listener on this entity that a path could not be found
-                NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                    &NavigationComponentNotificationBus::Events::OnTraversalCancelled,
-                    m_lastResponseCache.GetRequestId());
-            }
-        }
-    }
-
-    void NavigationComponent::Stop(PathfindRequest::NavigationRequestId requestId)
-    {
-        if ((m_lastResponseCache.GetRequestId() == requestId)
-            && requestId != PathfindResponse::kInvalidRequestId)
-        {
-            Reset();
-        }
-    }
-
-    float NavigationComponent::GetAgentSpeed()
-    {
-        return m_agentSpeed;
-    }
-
-    void NavigationComponent::SetAgentSpeed(float agentSpeed)
-    {
-        m_agentSpeed = agentSpeed;
-
-        IPathFollowerPtr pathFollower = m_lastResponseCache.GetPathFollower();
-
-        if (pathFollower)
-        {
-            PathFollowerParams currentParams = pathFollower->GetParams();
-            currentParams.normalSpeed = agentSpeed;
-            currentParams.minSpeed = currentParams.normalSpeed * 0.8f;
-            currentParams.maxSpeed = currentParams.normalSpeed * 1.2f;
-
-            pathFollower->SetParams(currentParams);
-        }
-    }
-
-    NavigationComponentRequests::MovementMethod NavigationComponent::GetAgentMovementMethod()
-    {
-        return m_movementMethod;
-    }
-
-    void NavigationComponent::SetAgentMovementMethod(NavigationComponentRequests::MovementMethod movementMethod)
-    {
-        m_movementMethod = movementMethod;
-    }
-
-    void NavigationComponent::MoveEntity(float deltaTime)
-    {
-        // If there isn't a valid path
-        if (!m_lastResponseCache.GetCurrentPath())
-        {
-            // Come back next frame
-            return;
-        }
-
-        AZ::Vector3 currentVelocity = AZ::Vector3::CreateZero();
-        float mass = 0.f;
-
-        if (m_movementMethod == NavigationComponentRequests::MovementMethod::Physics)
-        {
-            {
-                Physics::RigidBodyRequestBus::EventResult(currentVelocity, GetEntityId(),
-                    &Physics::RigidBodyRequestBus::Events::GetLinearVelocity);
-
-                Physics::RigidBodyRequestBus::EventResult(mass, GetEntityId(),
-                    &Physics::RigidBodyRequestBus::Events::GetMass);
-            }
-
-            m_lastResponseCache.SetLastKnownAgentVelocity(currentVelocity);
-        }
-
-        // Update path-following and extract desired velocity.
-        AZ::Vector3 nextPathPosition = AZ::Vector3::CreateZero();
-        AZ::Vector3 inflectionPosition = AZ::Vector3::CreateZero();
-        AZ::Vector3 targetVelocity = AZ::Vector3::CreateZero();
-        float distanceToEnd = 0.f;
-
-        auto pathFollower = m_lastResponseCache.GetPathFollower();
-        if (pathFollower)
-        {
-            const AZ::Vector3 agentPosition = m_entityTransform.GetTranslation();
-            const AZ::Vector3 agentVelocity = m_lastResponseCache.GetLastKnownAgentVelocity();
-
-            PathFollowResult result;
-
-            [[maybe_unused]] const bool arrived = pathFollower->Update(
-                result,
-                AZVec3ToLYVec3(agentPosition),
-                AZVec3ToLYVec3(agentVelocity),
-                deltaTime);
-
-            nextPathPosition = LYVec3ToAZVec3(result.followTargetPos);
-            inflectionPosition = LYVec3ToAZVec3(result.inflectionPoint);
-            targetVelocity = LYVec3ToAZVec3(result.velocityOut);
-            distanceToEnd = result.distanceToEnd;
-        }
-
-        if (targetVelocity == AZ::Vector3::CreateZero())
-        {
-            if (m_movementMethod == NavigationComponentRequests::MovementMethod::Physics)
-            {
-                if (!m_usesCharacterPhysics)
-                {
-                    Physics::RigidBodyRequestBus::Event(GetEntityId(),
-                        &Physics::RigidBodyRequestBus::Events::SetLinearVelocity, AZ::Vector3::CreateZero());
-                }
-            }
-
-            // Set the status of this request
-            m_lastResponseCache.SetStatus(PathfindResponse::Status::TraversalComplete);
-
-            // Reset the pathfinding component
-            Reset();
-
-            // Inform every listener on this entity that the path has been finished
-            NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                &NavigationComponentNotificationBus::Events::OnTraversalComplete, m_lastResponseCache.GetRequestId());
-        }
-        else
-        {
-            if (m_movementMethod == NavigationComponentRequests::MovementMethod::Custom)
-            {
-                if (!nextPathPosition.IsClose(m_lastResponseCache.GetNextPathPosition()) ||
-                    !inflectionPosition.IsClose(m_lastResponseCache.GetInflectionPosition()))
-                {
-                    m_lastResponseCache.SetNextPathPosition(nextPathPosition);
-                    m_lastResponseCache.SetInflectionPosition(inflectionPosition);
-
-                    // when using the custom movement method we just update the path and rely on
-                    // the user to move the entity
-                    NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                        &NavigationComponentNotificationBus::Events::OnTraversalPathUpdate,
-                        m_lastResponseCache.GetRequestId(),
-                        nextPathPosition, inflectionPosition);
-
-                }
-            }
-            else if (m_movementMethod == NavigationComponentRequests::MovementMethod::Physics)
-            {
-                {
-                    AZ::Vector3 forceRequired = (targetVelocity - currentVelocity) * mass;
-                    forceRequired.SetZ(0);
-
-                    if (m_usesCharacterPhysics)
-                    {
-                        Physics::CharacterRequestBus::Event(GetEntityId(),
-                            &Physics::CharacterRequestBus::Events::AddVelocity, targetVelocity);
-                    }
-                    else
-                    {
-                        Physics::RigidBodyRequestBus::Event(GetEntityId(),
-                            &Physics::RigidBodyRequestBus::Events::ApplyLinearImpulse, forceRequired);
-                    }
-                }
-            }
-            else
-            {
-                // Set the position of the entity
-                AZ::Transform newEntityTransform = m_entityTransform;
-                AZ::Vector3 movementDelta = targetVelocity * deltaTime;
-                AZ::Vector3 newPosition = m_entityTransform.GetTranslation() + movementDelta;
-                newEntityTransform.SetTranslation(newPosition);
-                AZ::TransformBus::Event(m_entity->GetId(), &AZ::TransformBus::Events::SetWorldTM, newEntityTransform);
-
-                m_lastResponseCache.SetLastKnownAgentVelocity(targetVelocity);
-            }
-
-            m_lastResponseCache.SetStatus(PathfindResponse::Status::TraversalInProgress);
-
-            NavigationComponentNotificationBus::Event(m_entity->GetId(),
-                &NavigationComponentNotificationBus::Events::OnTraversalInProgress, m_lastResponseCache.GetRequestId(),
-                distanceToEnd);
-        }
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // AZ::TickBus::Handler implementation
-
-    void NavigationComponent::OnTick(float deltaTime, AZ::ScriptTimePoint /*time*/)
-    {
-        MoveEntity(deltaTime);
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // AZ::TransformNotificationBus::Handler implementation
-    // If the transform on the entity has changed
-    void NavigationComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
-    {
-        m_entityTransform = world;
-    }
-
-    //////////////////////////////////////////////////////////////////////////
-    // NavigationComponent implementation
-
-    void NavigationComponent::Reset()
-    {
-        m_lastResponseCache.Reset();
-
-        // Disconnect from tick bus and physics bus
-        AZ::TickBus::Handler::BusDisconnect();
-        m_sceneStartSimHandler.Disconnect();
-    }
-
-    PathfindRequest::NavigationRequestId NavigationComponent::FindPathToEntity(AZ::EntityId targetEntityId)
-    {
-        PathfindRequest request;
-        request.SetTargetEntityId(targetEntityId);
-        return FindPath(request);
-    }
-
-    PathfindRequest::NavigationRequestId NavigationComponent::FindPathToPosition(const AZ::Vector3& destination)
-    {
-        PathfindRequest request;
-        request.SetDestinationLocation(destination);
-        return FindPath(request);
-    }
-} // namespace LmbrCentral

+ 0 - 349
Gems/LmbrCentral/Code/Source/Ai/NavigationComponent.h

@@ -1,349 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <LmbrCentral/Ai/NavigationComponentBus.h>
-
-// Cry pathfinding system includes
-#include <INavigationSystem.h>
-
-// Component factory
-#include <AzCore/RTTI/RTTI.h>
-
-// Component utilization
-#include <AzCore/Component/Entity.h>
-#include <AzCore/Component/Component.h>
-#include <AzCore/Component/ComponentBus.h>
-
-// Other buses used
-#include <AzCore/Component/TickBus.h>
-#include <AzCore/Component/EntityBus.h>
-#include <AzFramework/Physics/Common/PhysicsEvents.h>
-
-// Data and containers
-#include <AzCore/Math/Crc.h>
-#include <AzCore/std/smart_ptr/shared_ptr.h>
-
-// Forward-declare legacy AI interfaces to avoid an include dependency on IPathfinder.h.
-class IPathFollower;
-class INavPath;
-using IPathFollowerPtr = AZStd::shared_ptr<IPathFollower>;
-using INavPathPtr = AZStd::shared_ptr<INavPath>;
-
-namespace LmbrCentral
-{
-    class NavigationComponent;
-
-    /**
-    * Represents the response to any pathfinding request.
-    * Stores the original request and the current state
-    * along with relevant pathfinding data
-    */
-    class PathfindResponse
-        : private AZ::TransformNotificationBus::Handler
-        , private AZ::EntityBus::Handler
-    {
-    public:
-
-        enum class Status
-        {
-            Uninitialized,
-            Initialized,
-            WaitingForTargetEntity,
-            SearchingForPath,
-            PathFound,
-            TraversalStarted,
-            TraversalInProgress,
-            TraversalComplete,
-            TraversalCancelled
-        };
-
-        using PathfinderRequestId = AZ::u32;
-
-        PathfindResponse();
-
-        void SetOwningComponent(NavigationComponent* navComponent);
-
-        const PathfindRequest& GetRequest() const;
-        PathfindRequest::NavigationRequestId GetRequestId() const;
-        PathfinderRequestId GetPathfinderRequestId() const;
-        void SetPathfinderRequestId(PathfinderRequestId pathfinderRequestId);
-
-        const AZ::Vector3& GetCurrentDestination() const;
-
-        Status GetStatus() const;
-        void SetStatus(Status status);
-
-        void SetCurrentPath(const INavPathPtr& currentPath);
-        INavPathPtr GetCurrentPath();
-
-        void Reset();
-
-        /**
-        * Sets up a response for a newly received request
-        */
-        void SetupForNewRequest(NavigationComponent* ownerComponent, const PathfindRequest& request);
-
-        //////////////////////////////////////////////////////////////////////////////////
-        // Transform notification bus handler
-        /// Called when the local transform of the entity has changed.
-        void OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& /*world*/) override;
-        //////////////////////////////////////////////////////////////////////////////////
-
-        ////////////////////////////////////////////////////////////////////////
-        // EntityEvents
-        void OnEntityActivated(const AZ::EntityId&) override;
-        void OnEntityDeactivated(const AZ::EntityId&) override;
-        ////////////////////////////////////////////////////////////////////////
-
-        const AZ::Vector3& GetLastKnownAgentVelocity() const;
-        void SetLastKnownAgentVelocity(const AZ::Vector3& newVelocity);
-
-        const AZ::Vector3& GetNextPathPosition() const;
-        void SetNextPathPosition(const AZ::Vector3& newPosition);
-        
-        const AZ::Vector3& GetInflectionPosition() const;
-        void SetInflectionPosition(const AZ::Vector3& newPosition);
-
-        IPathFollowerPtr GetPathFollower();
-        
-        //! Invalid request id
-        static const PathfindRequest::NavigationRequestId kInvalidRequestId = 0;
-
-    private:
-
-        //! The request that created this response
-        PathfindRequest m_request;
-
-        //////////////////////////////////////////////////////////////////////
-        // Response members
-
-        /** Represents the destination that the entity is currently trying to reach.
-        * This may be different than the original destination.
-        * This change generally happens when the Component Entity is asked to pathfind to
-        * another entity that may be moving
-        */
-        AZ::Vector3 m_currentDestination;
-
-        /** The identifier for this request
-        * Does not change for any given request, is used by the requester and other components
-        * to identify this pathfinding query uniquely
-        */
-        PathfindRequest::NavigationRequestId m_requestId;
-
-        /** The identifier used by the pathfinder for queries pertaining to this request
-        * May change during the lifetime of any particular request, generally in response to situations that
-        * necessitate an update in the path. Following an entity is a prime example, the entity being followed
-        * may move and new pathfinding queries may be generated and pushed to the pathfinding system to make sure
-        * this entity pathfinds properly. In such a scenario, this id changes.
-        */
-        PathfinderRequestId m_pathfinderRequestId;
-
-        //! Stores the status of this request
-        Status m_responseStatus;
-
-        //! Points back to the navigation component that is handling this request / response
-        NavigationComponent* m_navigationComponent;
-
-        //! Last known velocity of the agent
-        AZ::Vector3 m_previousAgentVelocity;
-
-        //! Next position in path to travel to
-        AZ::Vector3 m_nextPathPosition;
-
-        //! Inflection position (where the path turns) past the next position
-        AZ::Vector3 m_inflectionPosition;
-
-        IPathFollowerPtr m_pathFollower;
-        INavPathPtr m_currentPath;
-
-        //////////////////////////////////////////////////////////////////////
-
-        class NullPathObstacles : public IPathObstacles
-        {
-        public:
-
-            bool IsPathIntersectingObstacles(const NavigationMeshID /*meshID*/, const Vec3& /*start*/, const Vec3& /*end*/, float /*radius*/) const override { return false; }
-            bool IsPointInsideObstacles(const Vec3& /*position*/) const override { return false; }
-            bool IsLineSegmentIntersectingObstaclesOrCloseToThem(const Lineseg& /*linesegToTest*/, float /*maxDistanceToConsiderClose*/) const override { return false; }
-        };
-
-        NullPathObstacles m_pathObstacles;
-
-        //! the current request id
-        static PathfindRequest::NavigationRequestId s_nextRequestId;
-    };
-
-    /*!
-    * The Navigation component provides basic pathfinding and path following services to an Entity.
-    * It serves AI or other Game Logic by accepting navigation commands and dispatching per-frame
-    * movement requests to the Physics component in order to follow the calculated path.
-    */
-    class NavigationComponent
-        : public AZ::Component
-        , public NavigationComponentRequestBus::Handler
-        , public IAIPathAgent
-        , public AZ::TickBus::Handler
-        , public AZ::TransformNotificationBus::Handler
-    {
-    public:
-
-        AZ_COMPONENT(NavigationComponent, "{92284847-9BB3-4CF0-9017-F7E5CEDF3B7B}")
-        NavigationComponent();
-        friend void PathfindResponse::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& /*world*/);
-        friend void PathfindResponse::OnEntityActivated(const AZ::EntityId&);
-
-        //////////////////////////////////////////////////////////////////////////
-        // AZ::Component interface implementation
-        void Init() override;
-        void Activate() override;
-        void Deactivate() override;
-
-        //////////////////////////////////////////////////////////////////////////
-        // NavigationComponentRequests::Bus::Handler interface implementation
-        PathfindRequest::NavigationRequestId FindPath(const PathfindRequest& request) override;
-        PathfindRequest::NavigationRequestId FindPathToEntity(AZ::EntityId targetEntityId) override;
-        PathfindRequest::NavigationRequestId FindPathToPosition(const AZ::Vector3& destination) override;
-        void Stop(PathfindRequest::NavigationRequestId requestId) override;
-        float GetAgentSpeed() override;
-        void SetAgentSpeed(float agentSpeed) override;
-        NavigationComponentRequests::MovementMethod GetAgentMovementMethod() override;
-        void SetAgentMovementMethod(NavigationComponentRequests::MovementMethod movementMethod) override;
-        ///////////////////////////////////
-
-        //////////////////////////////////////////////////////////////////////////
-        // TickBus
-        void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
-        //////////////////////////////////////////////////////////////////////////
-
-        //////////////////////////////////////////////////////////////////////////////////
-        // Transform notification bus listener
-
-        /// Called when the local transform of the entity has changed. Local transform update always implies world transform change too.
-        void OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& /*world*/) override;
-
-        //////////////////////////////////////////////////////////////////////////////////
-
-        float GetArrivalDistance() const        { return m_arrivalDistanceThreshold; }
-        float GetAgentRadius() const            { return m_agentRadius; }
-        bool GetAllowVerticalNavigation() const { return m_allowVerticalNavigation;  }
-
-    private:
-#ifdef LMBR_CENTRAL_EDITOR
-        AZStd::vector<AZStd::string> PopulateAgentTypeList();
-        AZ::u32 HandleAgentTypeChanged();
-        float CalculateAgentNavigationRadius(const char* agentTypeName);
-        const char* GetDefaultAgentNavigationTypeName();
-#endif
-        void FindPathImpl();
-
-        // Nav Component settings
-
-        /**
-        * Describes the "type" of the Entity for navigation purposes.
-        * This type is used to select which navmesh this entity will follow in a scenario where multiple navmeshes are available
-        */
-        AZStd::string m_agentType;
-
-        //! The speed of at which the agent should move
-        float m_agentSpeed;
-
-        //! Describes the radius of this entity for navigation purposes
-        float m_agentRadius;
-
-        //! Describes the distance from the end point that an entity needs to be before its movement is to be stopped and considered complete
-        float m_arrivalDistanceThreshold;
-
-        //! Describes the distance from its previously known location that a target entity needs to move before a new path is calculated
-        float m_repathThreshold;
-
-        //! Indicates whether the entity moves under physics or by modifying the Entity Transform
-        bool m_movesPhysically;
-
-        //! Indicates whether the entity uses legacy physics
-        bool m_usesLegacyPhysics;
-
-        //! Indicates whether the entity being moved is a character
-        bool m_usesCharacterPhysics;
-
-        //! Indicates whether vertical navigation is allowed 
-        bool m_allowVerticalNavigation;
-
-        //! Indicates how the agent is moved
-        NavigationComponentRequests::MovementMethod m_movementMethod;
-
-        // Runtime data
-
-        //! Stores the transform of the entity this component is attached to
-        AZ::Transform m_entityTransform;
-
-        //! Cache the last response (and request) received by the Navigation Component
-        PathfindResponse m_lastResponseCache;
-
-        //! The Navigation Agent Type identifier used by the Navigation system
-        NavigationAgentTypeID   m_agentTypeId;
-
-        /**
-        * Uses the data in "m_lastResponseCache" to request a path from the pathfinder
-        */
-        PathfindResponse::PathfinderRequestId RequestPath();
-
-        /**
-         * Compute required entity velocity and move by setting the position or applying an impulse
-         */
-        void MoveEntity(float deltaTime);
-
-        /**
-        * Resets the Navigation Component and prepares it to process a new pathfinding request
-        * Also cancels any pathfinding operations in progress
-        */
-        void Reset();
-
-        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
-        {
-            provided.push_back(AZ_CRC("NavigationService", 0xf31e77fe));
-        }
-
-        static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
-        {
-            dependent.push_back(AZ_CRC_CE("PhysicsRigidBodyService"));
-            dependent.push_back(AZ_CRC_CE("PhysicsCharacterControllerService"));
-        }
-
-        //////////////////////////////////////////////////////////////////////////
-        // This component will require the services of the transform component in
-        // the short term and the physics component in the long term
-        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
-        {
-            required.push_back(AZ_CRC("TransformService", 0x8ee22c50));
-        }
-
-        static void Reflect(AZ::ReflectContext* context);
-
-        AzPhysics::SceneEvents::OnSceneSimulationStartHandler m_sceneStartSimHandler;
-    protected:
-
-        void OnPathResult(const MNM::QueuedPathID& requestId, MNMPathRequestResult& result);
-
-        //// IAIPathAgent
-        const char* GetPathAgentName() const override { return m_entity->GetName().c_str(); }
-        void GetPathAgentNavigationBlockers(NavigationBlockers&, const ::PathfindRequest*) override {}
-        AZ::u16 GetPathAgentType() const override { return 0; }
-        Vec3 GetPathAgentPos() const override { return Vec3(); }
-        float GetPathAgentPassRadius() const override { return 0.f; }
-        Vec3 GetPathAgentVelocity() const override { return ZERO; }
-        void SetPathToFollow(const char*) override {}
-        void SetPathAttributeToFollow(bool) override {}
-        void SetPFBlockerRadius(int, float) override {}
-        bool GetValidPositionNearby(const Vec3&, Vec3&) const override { return false; }
-        bool GetTeleportPosition(Vec3&) const override { return false; }
-        class IPathFollower* GetPathFollower() const override { return nullptr; }
-        bool IsPointValidForAgent(const Vec3&, AZ::u32) const override { return true; };
-        //// ~IAIPathAgent
-    };
-} // namespace LmbrCentral

+ 0 - 107
Gems/LmbrCentral/Code/Source/Ai/NavigationSystemComponent.cpp

@@ -1,107 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#include "NavigationSystemComponent.h"
-
-#include <AzCore/RTTI/BehaviorContext.h>
-#include <AzCore/Serialization/SerializeContext.h>
-#include <AzCore/Memory/SystemAllocator.h>
-
-// AZ to LY conversion
-#include <MathConversion.h>
-
-// for INavigationSystem access
-#include <ISystem.h>
-#include <INavigationSystem.h>
-
-
-namespace LmbrCentral
-{
-    AZ_CLASS_ALLOCATOR_IMPL(NavRayCastResult, AZ::SystemAllocator, 0)
-
-    void NavigationSystemComponent::Reflect(AZ::ReflectContext* context)
-    {
-        if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
-        {
-            serializeContext->Class<NavigationSystemComponent, Component>()
-                ->Version(1)
-                ;
-
-            serializeContext->Class<NavRayCastResult>()
-                ->Version(1)
-                ->Field("collision", &NavRayCastResult::m_collision)
-                ->Field("position", &NavRayCastResult::m_position)
-                ->Field("meshId", &NavRayCastResult::m_meshId)
-                ;
-        }
-
-        if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
-        {
-            // RayCastWorld return type
-            behaviorContext->Class<NavRayCastResult>()
-                ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
-                ->Property("collision", BehaviorValueGetter(&NavRayCastResult::m_collision), nullptr)
-                ->Property("position", BehaviorValueGetter(&NavRayCastResult::m_position), nullptr)
-                ->Property("meshId", BehaviorValueGetter(&NavRayCastResult::m_meshId), nullptr)
-                ;
-
-            behaviorContext->EBus<NavigationSystemRequestBus>("NavigationSystemRequestBus")
-                ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All)
-                ->Event("RayCast", &NavigationSystemRequestBus::Events::RayCast)
-                ;
-        }
-    }
-
-    void NavigationSystemComponent::Activate()
-    {
-        // start listening for for OnCrySystemInitialized call
-        CrySystemEventBus::Handler::BusConnect();
-    }
-
-    void NavigationSystemComponent::Deactivate()
-    {
-        // disconnect the bus here, in case it hasn't already been disconnected in OnCrySystemShutdown
-        NavigationSystemRequestBus::Handler::BusDisconnect();
-
-        // disconnect here even if we haven't received OnCrySystemShutdown
-        CrySystemEventBus::Handler::BusDisconnect();
-    }
-
-    NavRayCastResult NavigationSystemComponent::RayCast(const AZ::Vector3& begin, const AZ::Vector3& direction, float maxDistance)
-    {
-        NavRayCastResult result;
-
-        // Convert to Cry
-        const Vec3 LYstart = AZVec3ToLYVec3(begin);
-        const Vec3 LYend = AZVec3ToLYVec3(begin + (direction * maxDistance));
-
-        const INavigationSystem* navigationSystem = nullptr; // INavigationSystem will be converted to an AZInterface (LY-111343)
-        if (navigationSystem)
-        {
-            // perform raycast
-            const std::tuple<bool, NavigationMeshID, Vec3> LYResult = navigationSystem->RaycastWorld(LYstart, LYend);
-
-            // translate result
-            result.m_collision = std::get<0>(LYResult);
-            result.m_meshId = std::get<1>(LYResult);
-            result.m_position = LYVec3ToAZVec3(std::get<2>(LYResult));
-        }
-
-        return result;
-    }
-
-    void NavigationSystemComponent::OnCrySystemInitialized([[maybe_unused]] ISystem& system, const SSystemInitParams&)
-    {
-        NavigationSystemRequestBus::Handler::BusConnect();
-    }
-
-    void NavigationSystemComponent::OnCrySystemShutdown([[maybe_unused]] ISystem& system)
-    {
-        // disconnect the bus here, in case it hasn't already been disconnected from Deactivate
-        NavigationSystemRequestBus::Handler::BusDisconnect();
-    }
-} // namespace LmbrCentral

+ 0 - 59
Gems/LmbrCentral/Code/Source/Ai/NavigationSystemComponent.h

@@ -1,59 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <LmbrCentral/Ai/NavigationSystemBus.h>
-#include <AzCore/Component/Component.h>
-#include <CrySystemBus.h>
-
-namespace LmbrCentral
-{
-    /*!
-    * System component that allows access to the navigation system
-    */
-    class NavigationSystemComponent
-        : public AZ::Component
-        , public NavigationSystemRequestBus::Handler
-        , public CrySystemEventBus::Handler
-    {
-    public:
-        AZ_COMPONENT(NavigationSystemComponent, "{3D27484B-00C4-4F3F-9605-2BF3E5C317FF}");
-
-        static void Reflect(AZ::ReflectContext* context);
-
-        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
-        {
-            provided.push_back(AZ_CRC("NavigationSystemService", 0x48446078));
-        }
-
-        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
-        {
-            incompatible.push_back(AZ_CRC("NavigationSystemService", 0x48446078));
-        }
-
-        ~NavigationSystemComponent() override {}
-
-    private:
-        ////////////////////////////////////////////////////////////////////////
-        // AZ::Component
-        void Activate() override;
-        void Deactivate() override;
-        ////////////////////////////////////////////////////////////////////////
-
-        ////////////////////////////////////////////////////////////////////////
-        // NavigationSystemRequestBus
-        NavRayCastResult RayCast(const AZ::Vector3& begin, const AZ::Vector3& direction, float maxDistance) override;
-        ////////////////////////////////////////////////////////////////////////
-
-        ////////////////////////////////////////////////////////////////////////
-        // CrySystemEvents
-        void OnCrySystemInitialized(ISystem&, const SSystemInitParams&) override;
-        void OnCrySystemShutdown(ISystem&) override;
-        ////////////////////////////////////////////////////////////////////////
-    };
-} // namespace LmbrCentral

+ 0 - 5
Gems/LmbrCentral/Code/Source/LmbrCentral.cpp

@@ -27,13 +27,11 @@
 #include "Audio/AudioSystemComponent.h"
 #include "Audio/AudioTriggerComponent.h"
 #include "Bundling/BundlingSystemComponent.h"
-#include "Ai/NavigationComponent.h"
 #include "Scripting/TagComponent.h"
 #include "Scripting/SimpleStateComponent.h"
 #include "Scripting/SpawnerComponent.h"
 #include "Scripting/LookAtComponent.h"
 #include "Scripting/RandomTimedSpawnerComponent.h"
-#include "Ai/NavigationSystemComponent.h"
 #include "Geometry/GeometrySystemComponent.h"
 #include <Asset/AssetSystemDebugComponent.h>
 
@@ -182,7 +180,6 @@ namespace LmbrCentral
             LmbrCentralAllocatorComponent::CreateDescriptor(),
             LmbrCentralAssetBuilderAllocatorComponent::CreateDescriptor(),
             LmbrCentralSystemComponent::CreateDescriptor(),
-            NavigationComponent::CreateDescriptor(),
             SimpleStateComponent::CreateDescriptor(),
             SpawnerComponent::CreateDescriptor(),
             LookAtComponent::CreateDescriptor(),
@@ -199,7 +196,6 @@ namespace LmbrCentral
             ReferenceShapeComponent::CreateDescriptor(),
             SplineComponent::CreateDescriptor(),
             PolygonPrismShapeComponent::CreateDescriptor(),
-            NavigationSystemComponent::CreateDescriptor(),
             GeometrySystemComponent::CreateDescriptor(),
             RandomTimedSpawnerComponent::CreateDescriptor(),
             SphereShapeDebugDisplayComponent::CreateDescriptor(),
@@ -233,7 +229,6 @@ namespace LmbrCentral
                    azrtti_typeid<LmbrCentralAllocatorComponent>(),
                    azrtti_typeid<LmbrCentralAssetBuilderAllocatorComponent>(),
                    azrtti_typeid<LmbrCentralSystemComponent>(),
-                   azrtti_typeid<NavigationSystemComponent>(),
                    azrtti_typeid<GeometrySystemComponent>(),
                    azrtti_typeid<AudioSystemComponent>(),
                    azrtti_typeid<BundlingSystemComponent>(),

+ 0 - 4
Gems/LmbrCentral/Code/Source/LmbrCentralEditor.cpp

@@ -9,8 +9,6 @@
 
 #include "LmbrCentralEditor.h"
 
-#include "Ai/EditorNavigationAreaComponent.h"
-#include "Ai/EditorNavigationSeedComponent.h"
 #include "Audio/EditorAudioAreaEnvironmentComponent.h"
 #include "Audio/EditorAudioEnvironmentComponent.h"
 #include "Audio/EditorAudioListenerComponent.h"
@@ -80,8 +78,6 @@ namespace LmbrCentral
             EditorSplineComponent::CreateDescriptor(),
             EditorPolygonPrismShapeComponent::CreateDescriptor(),
             EditorCommentComponent::CreateDescriptor(),
-            EditorNavigationAreaComponent::CreateDescriptor(),
-            EditorNavigationSeedComponent::CreateDescriptor(),
             EditorRandomTimedSpawnerComponent::CreateDescriptor(),
             EditorSpawnerComponent::CreateDescriptor(),            
             CopyDependencyBuilder::CopyDependencyBuilderComponent::CreateDescriptor(),

+ 0 - 1
Gems/LmbrCentral/Code/Tests/lmbrcentral_tests_files.cmake

@@ -29,7 +29,6 @@ set(FILES
     ShapeTestUtils.cpp
     ShapeTestUtils.h
     ../Source/LmbrCentral.cpp
-    ../Source/Ai/NavigationComponent.cpp
     ../Source/Scripting/SpawnerComponent.cpp
     ../Source/Shape/TubeShape.cpp
 )

+ 0 - 35
Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationAreaBus.h

@@ -1,35 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <AzCore/EBus/EBus.h>
-
-namespace LmbrCentral
-{
-    /**
-     * Messages serviced by the EditorNavigationAreaComponent.
-     * The EditorNavigationAreaComponent produces meshes and a volume to create
-     * a NavMesh to be used by the runtime.
-     */
-    class NavigationAreaRequests
-        : public AZ::ComponentBus
-    {
-    public:
-        virtual ~NavigationAreaRequests() = default;
-
-        /**
-         * Update/refresh the navigation area (foe example if changes have occurred to it or its surroundings).
-         */
-        virtual void RefreshArea() {}
-    };
-
-    /**
-     * Bus to service requests made to the Navigation Area component.
-     */
-    using NavigationAreaRequestBus = AZ::EBus<NavigationAreaRequests>;
-} // namespace LmbrCentral

+ 0 - 302
Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationComponentBus.h

@@ -1,302 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <ISerialize.h>
-#include <IPathfinder.h>
-
-#include <AzCore/Component/ComponentBus.h>
-#include <AzCore/Component/TransformBus.h>
-
-#include <AzCore/Math/Vector3.h>
-#include <AzCore/std/string/string.h>
-#include <AzCore/std/containers/bitset.h>
-#include <MathConversion.h>
-#include <AzCore/std/smart_ptr/shared_ptr.h>
-
-namespace LmbrCentral
-{
-    /**
-    * Represents a request as submitted by a user of this component, can be used to configure the pathfinding
-    * queries by providing overrides for some default values as entered in the editor.
-    */
-    class PathfindRequest
-    {
-    public:
-
-        using NavigationRequestId = AZ::u32;
-
-        ///////////////////////////////////////////////////////////////////////////
-        // Destination
-
-        void SetDestinationLocation(const Vec3& destination)
-        {
-            SetDestinationLocation(LYVec3ToAZVec3(destination));
-        }
-
-        void SetDestinationLocation(const AZ::Vector3& destination)
-        {
-            if (!m_requestMask[RequestBits::DestinationEntity])
-            {
-                m_destination = destination;
-                m_requestMask.set(RequestBits::DestinationPosition);
-            }
-        }
-
-        AZ::Vector3 GetDestinationLocation() const
-        {
-            // If there is a target entity or a destination position
-            if (m_requestMask[RequestBits::DestinationEntity]
-                || m_requestMask[RequestBits::DestinationPosition])
-            {
-                return m_destination;
-            }
-            else
-            {
-                return AZ::Vector3::CreateZero();
-            }
-        }
-
-        void SetTargetEntityId(AZ::EntityId targetEntity)
-        {
-            if (m_requestMask[RequestBits::DestinationPosition])
-            {
-                m_requestMask.reset(RequestBits::DestinationPosition);
-            }
-
-            m_targetEntityId = targetEntity;
-            m_requestMask.set(RequestBits::DestinationEntity);
-
-            // Get the target entity's position
-            AZ::Transform entityTransform = AZ::Transform::CreateIdentity();
-            EBUS_EVENT_ID_RESULT(entityTransform, m_targetEntityId, AZ::TransformBus, GetWorldTM);
-            m_destination = entityTransform.GetTranslation();
-        }
-
-        AZ::EntityId GetTargetEntityId() const
-        {
-            if (m_requestMask[RequestBits::DestinationEntity])
-            {
-                return m_targetEntityId;
-            }
-            else
-            {
-                return AZ::EntityId();
-            }
-        }
-
-        ///////////////////////////////////////////////////////////////////////////
-
-        void SetArrivalDistanceThreshold(float arrivalDistanceThreshold)
-        {
-            m_arrivalDistanceThreshold = arrivalDistanceThreshold;
-            m_requestMask.set(RequestBits::ArrivalDistanceThreshold);
-        }
-
-        float GetArrivalDistanceThreshold() const
-        {
-            return m_arrivalDistanceThreshold;
-        }
-
-        PathfindRequest()
-            : m_arrivalDistanceThreshold(0)
-            , m_destination(AZ::Vector3::CreateZero())
-        {
-        }
-
-        bool HasTargetEntity() const
-        {
-            return m_requestMask[RequestBits::DestinationEntity];
-        }
-
-        bool HasTargetLocation() const
-        {
-            return m_requestMask[RequestBits::DestinationPosition];
-        }
-
-        bool HasOverrideArrivalDistance() const
-        {
-            return m_requestMask[RequestBits::ArrivalDistanceThreshold];
-        }
-
-    private:
-
-        enum RequestBits
-        {
-            DestinationPosition,
-            DestinationEntity,
-            ArrivalDistanceThreshold
-        };
-        /** Mask used to identify the values that were set / not set in any given request
-        * bit 0 : Vector 3 of the destination location
-        * bit 1 : AZ::Entity that is to be followed
-        * Note: Bit 0 and 1 are mutually exclusive , if both are set bit 1 takes precedence
-                So if both a Destination Entity and Location are set, only the Destination Entity is used
-        * bit 2 : The override Arrival distance threshold
-        */
-        AZStd::bitset<8> m_requestMask;
-
-        //! Destination as set by the requester
-        AZ::Vector3 m_destination;
-
-        //! Destination entity
-        AZ::EntityId m_targetEntityId;
-
-        // Request configuration parameters
-        //! Distance from target at which path traversing is considered complete
-        float m_arrivalDistanceThreshold;
-    };
-
-    /*!
-    * NavigationComponentRequests
-    * Requests serviced by the Navigation component.
-    */
-    class NavigationComponentRequests
-        : public AZ::ComponentBus
-    {
-    public:
-
-        //////////////////////////////////////////////////////////////////////////
-        // EBusTraits overrides (Configuring this Ebus)
-
-        // Only one component on a entity can implement these events
-        static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
-        //////////////////////////////////////////////////////////////////////////
-
-        virtual ~NavigationComponentRequests() {}
-
-        enum class MovementMethod
-        {
-            Transform,
-            Physics,
-            Custom
-        };
-
-        /** Finds a path as per the provided request configuration
-        * @param request Allows the issuer of the request to override one, all or none of the pathfinding configuration defaults for this entity
-        * @return Returns a unique identifier to this pathfinding request
-        */
-        virtual PathfindRequest::NavigationRequestId FindPath(const PathfindRequest& /*request*/) { return 0; }
-
-        /** Creates a path finding request to navigate towards the specified entity.
-        * @param entityId EntityId of the entity we want to navigate towards.
-        * @return Returns a unique identifier to this pathfinding request
-        */
-        virtual PathfindRequest::NavigationRequestId FindPathToEntity(AZ::EntityId /*entityId*/) { return 0; }
-
-        /** Creates a path finding request to navigate towards the specified position.
-        * @param destination World position we want to navigate to.
-        * @return Returns a unique identifier to this pathfinding request
-        */
-        virtual PathfindRequest::NavigationRequestId FindPathToPosition(const AZ::Vector3& /*destination*/) = 0;
-
-
-        /** Stops all pathfinding operations for the given requestId
-        * The id is primarily used to make sure that the request being cancelled is in-fact the
-        * request that is currently being processed. If the requestId given is different from the
-        * id of the current request, the stop command can be safely ignored
-        * @param requestId Used to identify the request that is being cancelled
-        */
-        virtual void Stop(PathfindRequest::NavigationRequestId requestId) = 0;
-     
-        /* Returns the current AI Agent's speed
-        *  @return Returns the current agent's speed as a float
-        */
-        virtual float GetAgentSpeed() = 0;
-
-        /* Updates the AI Agent's speed
-        *  @param agentSpeed specifies the new agent speed as a float
-        */
-        virtual void SetAgentSpeed(float agentSpeed) = 0;
-
-        /* Returns the current AI movement method 
-        *  @return Returns the current agent's movement method 
-        */
-        virtual MovementMethod GetAgentMovementMethod() = 0;
-
-        /* Updates the AI Agent's movement method 
-        *  @param movementMethod specifies the new agent movement method 
-        */
-        virtual void SetAgentMovementMethod(MovementMethod movementMethod) = 0;
-    };
-
-    // Bus to service the Navigation component event group
-    using NavigationComponentRequestBus = AZ::EBus<NavigationComponentRequests>;
-
-    /*!
-    * NavigationComponentNotifications
-    * Notifications sent by the Navigation component.
-    */
-    class NavigationComponentNotifications
-        : public AZ::ComponentBus
-    {
-    public:
-
-        //////////////////////////////////////////////////////////////////////////
-        // EBusTraits overrides (Configuring this Ebus)
-        static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
-
-        //////////////////////////////////////////////////////////////////////////
-
-        virtual ~NavigationComponentNotifications() {}
-
-        /**
-        * Indicates that the pathfinding request has been submitted to the navigation system
-        * @param requestId Id of the request for which path is being searched
-        */
-        virtual void OnSearchingForPath(PathfindRequest::NavigationRequestId /*requestId*/) {}
-
-        /**
-        * Indicates that a path has been found for the indicated request
-        * @param requestId Id of the request for which path has been found
-        * @param currentPath The path that was calculated by the Pathfinder
-        * @return boolean value indicating whether this path is to be traversed or not
-        */
-        virtual bool OnPathFound(PathfindRequest::NavigationRequestId /*requestId*/, AZStd::shared_ptr<const INavPath> /*currentPath*/)
-        {
-            return true;
-        };
-
-        /**
-        * Indicates that traversal for the indicated request has started
-        * @param requestId Id of the request for which traversal has started
-        */
-        virtual void OnTraversalStarted(PathfindRequest::NavigationRequestId /*requestId*/) {}
-
-        /**
-        * Indicates that traversal for the indicated request has started
-        * @param requestId Id of the request for which traversal is in progress
-        * @param distanceRemaining remaining distance in this path
-        */
-        virtual void OnTraversalInProgress(PathfindRequest::NavigationRequestId /*requestId*/, float /*distanceRemaining*/) {}
-
-        /**
-        * Indicates that the path for the traversal has updated.  If the 
-        * nextPathPosition and inflectionPosition are equal, they represent 
-        * the end of the path.
-        * @param requestId Id of the request for which traversal is in progress
-        * @param nextPathPosition furthest point on the path we can move to without colliding with anything 
-        * @param inflectionPosition next point on the path beyond nextPathPoint that deviates from a straight-line path
-        */
-        virtual void OnTraversalPathUpdate(PathfindRequest::NavigationRequestId /*requestId*/, const AZ::Vector3& /*nextPathPosition*/, const AZ::Vector3& /*inflectionPosition*/) {}
-
-        /**
-        * Indicates that traversal for the indicated request has completed successfully
-        * @param requestId Id of the request for which traversal has finished
-        */
-        virtual void OnTraversalComplete(PathfindRequest::NavigationRequestId /*requestId*/) {}
-
-        /**
-        * Indicates that traversal for the indicated request was cancelled before successful completion
-        * @param requestId Id of the request for which traversal was cancelled
-        */
-        virtual void OnTraversalCancelled(PathfindRequest::NavigationRequestId /*requestId*/) {}
-    };
-
-    using NavigationComponentNotificationBus = AZ::EBus<NavigationComponentNotifications>;
-} // namespace LmbrCentral

+ 0 - 28
Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationSeedBus.h

@@ -1,28 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <AzCore/EBus/EBus.h>
-
-namespace LmbrCentral
-{
-    /**
-     * Messages serviced by the NavigationSeedComponent.
-     * The NavigationSeedComponent traverses all the Navmesh nodes around it
-     * and mark the ones it was able to reach
-     */
-    class NavigationSeedRequests
-        : public AZ::EBusTraits
-    {
-    public:
-        virtual void RecalculateReachabilityAroundSelf() {}
-        virtual ~NavigationSeedRequests() = default;
-    };
-
-    using NavigationSeedRequestsBus = AZ::EBus<NavigationSeedRequests>;
-} // namespace LmbrCentral

+ 0 - 59
Gems/LmbrCentral/Code/include/LmbrCentral/Ai/NavigationSystemBus.h

@@ -1,59 +0,0 @@
-/*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
-#pragma once
-
-#include <AzCore/EBus/EBus.h>
-#include <AzCore/RTTI/ReflectContext.h>
-#include <AzCore/Math/Vector3.h>
-
-namespace LmbrCentral
-{
-    /**
-    * The result returned from the ray cast
-    */
-    struct NavRayCastResult
-    {
-        using NavigationMeshId = AZ::u32;
-
-        AZ_TYPE_INFO(NavRayCastResult, "{3135761F-9998-4623-A374-9364069E13AE}");
-        AZ_CLASS_ALLOCATOR_DECL
-
-        bool m_collision = false; ///< True if there was a collision
-        AZ::Vector3 m_position = AZ::Vector3::CreateZero();  ///< The position of the hit in world space
-        NavigationMeshId m_meshId = 0; ///< The mesh id of the navigation mesh hit
-    };
-
-    /*!
-    * NavigationSystemComponentRequests
-    * Requests serviced by the Navigation System component.
-    */
-    class NavigationSystemRequests
-        : public AZ::EBusTraits
-    {
-    public:
-
-        //////////////////////////////////////////////////////////////////////////
-        // EBus Traits overrides (Configuring this Ebus)
-        // Using Defaults
-        //////////////////////////////////////////////////////////////////////////
-
-        virtual ~NavigationSystemRequests() {}
-
-        /**
-        * Call the Navigation System RayCastWorld, and return the result
-
-         * \param begin         The origin of the ray
-         * \param direction     The direction for the ray to travel
-         * \param maxDistance   The maximum distance the ray will travel
-         */
-        virtual NavRayCastResult RayCast([[maybe_unused]] const AZ::Vector3& begin, [[maybe_unused]] const AZ::Vector3& direction, [[maybe_unused]] float maxDistance) { return NavRayCastResult(); }
-    };
-
-    using NavigationSystemRequestBus = AZ::EBus<NavigationSystemRequests>;
-
-} // namespace LmbrCentral

+ 0 - 8
Gems/LmbrCentral/Code/lmbrcentral_editor_files.cmake

@@ -76,16 +76,8 @@ set(FILES
     Source/Shape/EditorPolygonPrismShapeComponentMode.cpp
     Source/Shape/EditorShapeComponentConverters.h
     Source/Shape/EditorShapeComponentConverters.cpp
-    Source/Ai/EditorNavigationSeedComponent.h
-    Source/Ai/EditorNavigationSeedComponent.cpp
-    Source/Ai/EditorNavigationAreaComponent.h
-    Source/Ai/EditorNavigationAreaComponent.cpp
-    Source/Ai/EditorNavigationUtil.h
-    Source/Ai/EditorNavigationUtil.cpp
     Source/Editor/EditorCommentComponent.h
     Source/Editor/EditorCommentComponent.cpp
-    Source/Ai/NavigationComponent.h
-    Source/Ai/NavigationComponent.cpp
     Source/Scripting/SpawnerComponent.h
     Source/Scripting/SpawnerComponent.cpp
     Source/Shape/TubeShape.h

+ 0 - 2
Gems/LmbrCentral/Code/lmbrcentral_files.cmake

@@ -7,8 +7,6 @@
 #
 
 set(FILES
-    Source/Ai/NavigationSystemComponent.h
-    Source/Ai/NavigationSystemComponent.cpp
     Source/Audio/AudioAreaEnvironmentComponent.h
     Source/Audio/AudioAreaEnvironmentComponent.cpp
     Source/Audio/AudioEnvironmentComponent.h

+ 0 - 4
Gems/LmbrCentral/Code/lmbrcentral_headers_files.cmake

@@ -7,10 +7,6 @@
 #
 
 set(FILES
-    include/LmbrCentral/Ai/NavigationComponentBus.h
-    include/LmbrCentral/Ai/NavigationAreaBus.h
-    include/LmbrCentral/Ai/NavigationSystemBus.h
-    include/LmbrCentral/Ai/NavigationSeedBus.h
     include/LmbrCentral/Animation/AttachmentComponentBus.h
     include/LmbrCentral/Animation/SkeletalHierarchyRequestBus.h
     include/LmbrCentral/Audio/AudioEnvironmentComponentBus.h

+ 0 - 2
Gems/LmbrCentral/Code/lmbrcentral_shared_files.cmake

@@ -9,8 +9,6 @@
 set(FILES
     Source/LmbrCentral.h
     Source/LmbrCentral.cpp
-    Source/Ai/NavigationComponent.h
-    Source/Ai/NavigationComponent.cpp
     Source/Scripting/SpawnerComponent.h
     Source/Scripting/SpawnerComponent.cpp
     Source/Shape/TubeShape.h