mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-09 02:23:52 +00:00
feat(editor): patrol path visualization closes the loop back to start
This commit is contained in:
parent
f097763875
commit
53b2fc78fa
1 changed files with 4 additions and 2 deletions
|
|
@ -133,13 +133,15 @@ void EditorApp::run() {
|
||||||
gizmo.setMode(TransformMode::None);
|
gizmo.setMode(TransformMode::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patrol path visualization for the selected NPC
|
// Patrol path visualization for the selected NPC.
|
||||||
|
// Adds a loop-back to the start so users can see the cycle the creature follows.
|
||||||
if (auto* selNpc = npcSpawner_.getSelected();
|
if (auto* selNpc = npcSpawner_.getSelected();
|
||||||
selNpc && !selNpc->patrolPath.empty()) {
|
selNpc && !selNpc->patrolPath.empty()) {
|
||||||
std::vector<glm::vec3> pts;
|
std::vector<glm::vec3> pts;
|
||||||
pts.reserve(selNpc->patrolPath.size() + 1);
|
pts.reserve(selNpc->patrolPath.size() + 2);
|
||||||
pts.push_back(selNpc->position);
|
pts.push_back(selNpc->position);
|
||||||
for (const auto& wp : selNpc->patrolPath) pts.push_back(wp.position);
|
for (const auto& wp : selNpc->patrolPath) pts.push_back(wp.position);
|
||||||
|
if (selNpc->patrolPath.size() >= 2) pts.push_back(selNpc->position);
|
||||||
viewport_.setPatrolPath(pts);
|
viewport_.setPatrolPath(pts);
|
||||||
} else {
|
} else {
|
||||||
viewport_.clearPatrolPath();
|
viewport_.clearPatrolPath();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue