diff --git a/tools/editor/editor_camera.hpp b/tools/editor/editor_camera.hpp index 11c8b066..0911fafb 100644 --- a/tools/editor/editor_camera.hpp +++ b/tools/editor/editor_camera.hpp @@ -3,6 +3,7 @@ #include "rendering/camera.hpp" #include #include +#include namespace wowee { namespace editor { @@ -22,7 +23,12 @@ public: const rendering::Camera& getCamera() const { return camera_; } float getSpeed() const { return speed_; } - void setSpeed(float s) { speed_ = s; } + void setSpeed(float s) { + // Match the wheel-zoom clamp range. NaN/inf would propagate + // into camera position via update(); the cap also matches what + // the user can set via the wheel UI. + if (std::isfinite(s) && s >= 10.0f && s <= 2000.0f) speed_ = s; + } void setPosition(const glm::vec3& pos); void setYawPitch(float yaw, float pitch);