Now Path Following component works

This commit is contained in:
2026-04-27 05:37:41 +03:00
parent c80d9c96e6
commit a1b74aa2d5

View File

@@ -37,6 +37,8 @@
#include "../components/NavMesh.hpp"
#include "../components/SmartObject.hpp"
#include "../components/GoapPlanner.hpp"
#include "../components/GoapRunner.hpp"
#include "../components/PathFollowing.hpp"
#include "../components/PrefabInstance.hpp"
#include "../ui/TransformEditor.hpp"
@@ -97,8 +99,8 @@ bool EditorUISystem::onMousePressed(const Ogre::Ray &mouseRay)
return false;
// Cursor place mode: raycast and place cursor on surface
if (m_cursorMode == CursorInteractionMode::Place &&
m_physicsSystem && m_physicsSystem->isInitialized()) {
if (m_cursorMode == CursorInteractionMode::Place && m_physicsSystem &&
m_physicsSystem->isInitialized()) {
JoltPhysicsWrapper *physics =
m_physicsSystem->getPhysicsWrapper();
if (physics) {
@@ -119,16 +121,14 @@ bool EditorUISystem::onMousePressed(const Ogre::Ray &mouseRay)
// Cursor translate/rotate: delegate to Cursor3D axis-based interaction
if (m_cursorMode == CursorInteractionMode::Translate) {
m_cursor3D->setMode(Cursor3D::Mode::Translate);
Ogre::Camera *cam = m_editorCamera ?
m_editorCamera->getCamera() :
nullptr;
Ogre::Camera *cam =
m_editorCamera ? m_editorCamera->getCamera() : nullptr;
if (m_cursor3D->onMousePressed(mouseRay, cam))
return true;
} else if (m_cursorMode == CursorInteractionMode::Rotate) {
m_cursor3D->setMode(Cursor3D::Mode::Rotate);
Ogre::Camera *cam = m_editorCamera ?
m_editorCamera->getCamera() :
nullptr;
Ogre::Camera *cam =
m_editorCamera ? m_editorCamera->getCamera() : nullptr;
if (m_cursor3D->onMousePressed(mouseRay, cam))
return true;
}
@@ -1044,7 +1044,22 @@ void EditorUISystem::renderComponentList(flecs::entity entity)
// Render GoapPlanner if present
if (entity.has<GoapPlannerComponent>()) {
auto &planner = entity.get_mut<GoapPlannerComponent>();
m_componentRegistry.render<GoapPlannerComponent>(entity, planner);
m_componentRegistry.render<GoapPlannerComponent>(entity,
planner);
componentCount++;
}
// Render GoapRunner if present
if (entity.has<GoapRunnerComponent>()) {
auto &runner = entity.get_mut<GoapRunnerComponent>();
m_componentRegistry.render<GoapRunnerComponent>(entity, runner);
componentCount++;
}
// Render PathFollowing if present
if (entity.has<PathFollowingComponent>()) {
auto &pf = entity.get_mut<PathFollowingComponent>();
m_componentRegistry.render<PathFollowingComponent>(entity, pf);
componentCount++;
}