aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/camera.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index a9497152b..43009bd7c 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -133,16 +133,31 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize)
f32 bobfrac = (f32) bobframe / (BOBFRAMES/2);
f32 bobdir = (m_view_bobbing_anim < (BOBFRAMES/2)) ? 1.0 : -1.0;
+ #if 1
f32 bobknob = 1.2;
f32 bobtmp = sin(pow(bobfrac, bobknob) * PI);
v3f bobvec = v3f(
- 0.01 * bobdir * sin(bobfrac * PI),
- 0.005 * bobtmp * bobtmp,
+ bobdir * sin(bobfrac * PI),
+ 0.8 * bobtmp * bobtmp,
0.);
- rel_cam_pos += bobvec * 3.;
- rel_cam_target += bobvec * 4.5;
+ rel_cam_pos += 0.03 * bobvec;
+ rel_cam_target += 0.045 * bobvec;
+ rel_cam_up.rotateXYBy(0.03 * bobdir * bobtmp * PI);
+ #else
+ f32 angle_deg = 1 * bobdir * sin(bobfrac * PI);
+ f32 angle_rad = angle_deg * PI / 180;
+ f32 r = 0.05;
+ v3f off = v3f(
+ r * sin(angle_rad),
+ r * (cos(angle_rad) - 1),
+ 0);
+ rel_cam_pos += off;
+ //rel_cam_target += off;
+ rel_cam_up.rotateXYBy(angle_deg);
+ #endif
+
}
// Compute absolute camera position and target