feat(editor): NPC context menu adds Snap to Ground and Face Camera

Right-click context menu on a selected NPC now mirrors the object menu:
Snap to Ground drops it to terrain elevation, Face Camera rotates the NPC
to face the current camera position. Also annotates Duplicate with the
Ctrl+D shortcut hint.
This commit is contained in:
Kelsi 2026-05-06 01:30:27 -07:00
parent ec50c41044
commit b49cb344ac

View file

@ -2300,12 +2300,21 @@ void EditorUI::renderContextMenu(EditorApp& app) {
if (npcSel) {
if (ImGui::MenuItem("Fly To"))
app.flyToSelected();
if (ImGui::MenuItem("Duplicate")) {
if (ImGui::MenuItem("Snap to Ground"))
app.snapSelectedToGround();
if (ImGui::MenuItem("Duplicate", "Ctrl+D")) {
CreatureSpawn copy = *npcSel;
copy.position += glm::vec3(10, 10, 0);
app.getNpcSpawner().placeCreature(copy);
app.markObjectsDirty();
}
if (ImGui::MenuItem("Face Camera")) {
glm::vec3 cam = app.getEditorCamera().getCamera().getPosition();
glm::vec3 to = cam - npcSel->position;
npcSel->orientation = glm::degrees(std::atan2(to.y, to.x));
if (npcSel->orientation < 0.0f) npcSel->orientation += 360.0f;
app.markObjectsDirty();
}
}
ImGui::Separator();