Add movement accel/decel, camera smoothing, and Running animator hook

- Smooth acceleration/deceleration on ground and air movement
- Interpolated scroll zoom and low-pass smoothed orbit rotation
- Drive Animator "Running" bool while moving on the ground
- Add Paintman animator controllers and animation clips
- Update README and GAME_DESIGN docs for sprint, accel, camera smoothing and animator hookup

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-22 22:35:50 +02:00
1 parent 9e19146e35
commit 4c28d1488d
16 files changed
+1973 -12

No files matched your search

+38 -5
View File
@@ -38,6 +38,9 @@ public class ThirdPersonOrbitInput : MonoBehaviour
[Tooltip("Invert vertical look (mouse up tilts the camera down).")]
public bool invertY = false;
[Tooltip("Eases orbit rotation so quick mouse moves ramp in/out (higher = snappier, 0 = raw/instant).")]
public float rotationSmoothing = 20f;
[Header("Zoom")]
[Tooltip("Mouse wheel zooms the camera in and out (changes orbit radius).")]
public bool enableZoom = true;
@@ -45,6 +48,9 @@ public class ThirdPersonOrbitInput : MonoBehaviour
[Tooltip("World units the orbit radius changes per mouse wheel notch.")]
public float zoomSpeed = 0.5f;
[Tooltip("Eases the orbit radius toward the zoom target (higher = snappier, 0 = instant).")]
public float zoomSmoothing = 10f;
[Tooltip("Closest orbit radius (zoom in).")]
public float minRadius = 1.5f;
@@ -56,6 +62,9 @@ public class ThirdPersonOrbitInput : MonoBehaviour
public bool manageCursor = true;
CinemachineOrbitalFollow _orbit;
Vector2 _smoothedLook; // low-pass-filtered look delta (deg/frame) for eased rotation
float _targetRadius; // zoom radius the actual radius eases toward
bool _zoomInit; // _targetRadius seeded from the live radius yet?
/// <summary>Current orbit mode. Setting it also refreshes the cursor state.</summary>
public OrbitLookMode LookMode
@@ -95,23 +104,47 @@ public class ThirdPersonOrbitInput : MonoBehaviour
if (modeWantsLook && !LookSuppressed)
{
Vector2 delta = ReadMouseDelta();
if (delta.sqrMagnitude > 0f)
Vector2 raw = new Vector2(
delta.x * horizontalSensitivity,
delta.y * verticalSensitivity * (invertY ? 1f : -1f));
// Ease the per-frame look toward the raw delta so fast flicks ramp in/out
// instead of snapping; steady motion still converges to full sensitivity.
Vector2 applied = rotationSmoothing > 0f
? (_smoothedLook = Vector2.Lerp(_smoothedLook, raw, 1f - Mathf.Exp(-rotationSmoothing * Time.deltaTime)))
: raw;
if (applied.sqrMagnitude > 0f)
{
ApplyAxisDelta(ref _orbit.HorizontalAxis, delta.x * horizontalSensitivity);
float pitch = delta.y * verticalSensitivity * (invertY ? 1f : -1f);
ApplyAxisDelta(ref _orbit.VerticalAxis, pitch);
ApplyAxisDelta(ref _orbit.HorizontalAxis, applied.x);
ApplyAxisDelta(ref _orbit.VerticalAxis, applied.y);
}
}
else
{
_smoothedLook = Vector2.zero;
}
if (enableZoom)
{
if (!_zoomInit)
{
_targetRadius = _orbit.Radius;
_zoomInit = true;
}
float scroll = ReadScroll();
if (!Mathf.Approximately(scroll, 0f))
{
// One wheel notch = one zoom step (sign only), independent of the
// platform's raw wheel magnitude. Scrolling up zooms in.
_orbit.Radius = Mathf.Clamp(_orbit.Radius - Mathf.Sign(scroll) * zoomSpeed, minRadius, maxRadius);
_targetRadius = Mathf.Clamp(_targetRadius - Mathf.Sign(scroll) * zoomSpeed, minRadius, maxRadius);
}
// Ease the actual radius toward the target (frame-rate independent).
_orbit.Radius = zoomSmoothing > 0f
? Mathf.Lerp(_orbit.Radius, _targetRadius, 1f - Mathf.Exp(-zoomSmoothing * Time.deltaTime))
: _targetRadius;
}
}