Improved pathfinding logic

This commit is contained in:
Vladislav Khorev committed 2026-05-21 11:48:18 +03:00
1 parent 2659951d8e
commit 3a73f3fbde
36 files changed
+458337 -871

No files matched your search

+6 -4
View File
@@ -57,6 +57,7 @@ namespace ZL {
}
};
}
npcs[index]->homePosition = Eigen::Vector3f(x, 0.f, z);
npcs[index]->setTarget(Eigen::Vector3f(x, y, z), std::move(cb));
});
@@ -104,7 +105,7 @@ namespace ZL {
api.set_function("set_object_rotation", [game](const std::string& objectName, float value) {
for (auto& intObj : game->interactiveObjects) {
if (intObj.loadedObject.name == objectName) {
intObj.rotationY = value;
intObj.rotationY = value * static_cast<float>(M_PI) / 180.f;
std::cout << "[script] set_object_rotation: " << objectName << " " << value << std::endl;
return;
}
@@ -316,7 +317,7 @@ namespace ZL {
npcs[index]->setTarget(pos);
});
// npc_set_rotation(index, angle) — sets NPC facing angle around Y axis (radians).
// npc_set_rotation(index, angle) — sets NPC facing angle around Y axis (degrees).
api.set_function("npc_set_rotation",
[game](int index, float angle) {
auto& npcs = game->npcs;
@@ -324,8 +325,9 @@ namespace ZL {
std::cerr << "[script] npc_set_rotation: index " << index << " out of range\n";
return;
}
npcs[index]->facingAngle = angle;
npcs[index]->targetFacingAngle = angle;
const float rad = angle * static_cast<float>(M_PI) / 180.f;
npcs[index]->facingAngle = rad;
npcs[index]->targetFacingAngle = rad;
});
// set_npc_enabled(index, enabled)