Lower 3rd-to-1st person camera switch distance to 0.5

Separate the switch-to-first-person threshold from the default starting
distance so the camera can zoom in closer before transitioning. Both
mouse and touch inputs use the same new SWITCH_TO_FIRST_PERSON_DISTANCE
constant (0.5f), while MIN_DISTANCE (1.5f) remains as the default orbit
distance when activating 3rd person mode.

https://claude.ai/code/session_01KJ8KHH4XWx7F5VxhSNGo7M
This commit is contained in:
Claude 2026-03-14 03:11:38 +00:00
parent 74271aa189
commit 071e066e8d
No known key found for this signature in database
3 changed files with 5 additions and 4 deletions

View File

@ -54,6 +54,7 @@ class OrbitCamera {
static constexpr float MIN_PITCH = 0.05f; static constexpr float MIN_PITCH = 0.05f;
static constexpr float MAX_PITCH = 1.4f; static constexpr float MAX_PITCH = 1.4f;
static constexpr float MIN_DISTANCE = 1.5f; static constexpr float MIN_DISTANCE = 1.5f;
static constexpr float SWITCH_TO_FIRST_PERSON_DISTANCE = 0.5f;
static constexpr float MAX_DISTANCE = 15.0f; static constexpr float MAX_DISTANCE = 15.0f;
private: private:

View File

@ -91,7 +91,7 @@ void InputHandler::HandleSDLEvent(SDL_Event* p_event, OrbitCamera& p_orbit, bool
} }
break; break;
} }
if (p_orbit.GetOrbitDistance() <= OrbitCamera::MIN_DISTANCE && p_event->wheel.y > 0) { if (p_orbit.GetOrbitDistance() <= OrbitCamera::SWITCH_TO_FIRST_PERSON_DISTANCE && p_event->wheel.y > 0) {
m_wantsAutoDisable = true; m_wantsAutoDisable = true;
break; break;
} }
@ -215,7 +215,7 @@ void InputHandler::HandleSDLEvent(SDL_Event* p_event, OrbitCamera& p_orbit, bool
break; break;
} }
if (p_orbit.GetOrbitDistance() <= OrbitCamera::MIN_DISTANCE) { if (p_orbit.GetOrbitDistance() <= OrbitCamera::SWITCH_TO_FIRST_PERSON_DISTANCE) {
float totalDelta = newDist - m_touch.gesturePinchDist; float totalDelta = newDist - m_touch.gesturePinchDist;
if (totalDelta > PINCH_TRANSITION_THRESHOLD) { if (totalDelta > PINCH_TRANSITION_THRESHOLD) {
m_wantsAutoDisable = true; m_wantsAutoDisable = true;

View File

@ -117,8 +117,8 @@ void OrbitCamera::ClampPitch()
void OrbitCamera::ClampDistance() void OrbitCamera::ClampDistance()
{ {
if (m_orbitDistance < MIN_DISTANCE) { if (m_orbitDistance < SWITCH_TO_FIRST_PERSON_DISTANCE) {
m_orbitDistance = MIN_DISTANCE; m_orbitDistance = SWITCH_TO_FIRST_PERSON_DISTANCE;
} }
if (m_orbitDistance > MAX_DISTANCE) { if (m_orbitDistance > MAX_DISTANCE) {
m_orbitDistance = MAX_DISTANCE; m_orbitDistance = MAX_DISTANCE;