mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 09:03:52 +00:00
feat(editor): middle mouse orbit camera around terrain point
- Middle mouse drag orbits camera around the terrain point under cursor (or 100 units ahead if no terrain hit) - Maintains distance from pivot while rotating yaw/pitch - Much more intuitive for inspecting terrain features, placed objects, and NPC positions from different angles - Works alongside right-drag (free look) and WASD (fly)
This commit is contained in:
parent
62cfb92c38
commit
496f97f9db
3 changed files with 26 additions and 1 deletions
|
|
@ -263,7 +263,12 @@ void EditorApp::processEvents() {
|
|||
if (event.type == SDL_MOUSEMOTION && !io.WantCaptureMouse) {
|
||||
// Gizmo drag takes priority over camera
|
||||
auto& giz = viewport_.getGizmo();
|
||||
if (giz.isDragging()) {
|
||||
if (event.motion.state & SDL_BUTTON_MMASK) {
|
||||
// Middle mouse = orbit around brush/terrain point
|
||||
auto& brush = terrainEditor_.brush();
|
||||
glm::vec3 pivot = brush.isActive() ? brush.getPosition() : camera_.getCamera().getPosition() + camera_.getCamera().getForward() * 100.0f;
|
||||
camera_.processMiddleMouseMotion(event.motion.xrel, event.motion.yrel, pivot);
|
||||
} else if (giz.isDragging()) {
|
||||
auto ext = window_->getVkContext()->getSwapchainExtent();
|
||||
giz.updateDrag(glm::vec2(static_cast<float>(event.motion.x),
|
||||
static_cast<float>(event.motion.y)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue