From 6292c27c505c5f2a555ebbe5f184e2950c200534 Mon Sep 17 00:00:00 2001 From: Foxar Date: Mon, 7 Dec 2020 19:30:07 +0100 Subject: [PATCH] Added: Camera automatically shifts to an angle from behind the player. --- src/samples/dolphin/camera.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/samples/dolphin/camera.cpp b/src/samples/dolphin/camera.cpp index 5a9e61f..5c122f7 100755 --- a/src/samples/dolphin/camera.cpp +++ b/src/samples/dolphin/camera.cpp @@ -26,6 +26,10 @@ Camera::~Camera() {} void Camera::update(Pad &t_pad, Mesh &t_mesh) { + float cameraRot = (t_mesh.rotation.z * 180 / Math::PI) - (horizontalLevel * 180 / Math::PI); + cameraRot += 180; + cameraRot /= 15; + horizontalLevel += cameraRot / (180 / Math::PI); rotate(t_pad); followBy(t_mesh); Vector3 lookPos = Vector3(t_mesh.position.x, t_mesh.position.y + 10.0F, t_mesh.position.z); @@ -35,10 +39,10 @@ void Camera::update(Pad &t_pad, Mesh &t_mesh) void Camera::rotate(Pad &t_pad) { - if (t_pad.rJoyH <= 50) + if (t_pad.rJoyH <= 100) horizontalLevel -= 0.08; else if (t_pad.rJoyH >= 200) - horizontalLevel += 0.04; + horizontalLevel += 0.08; /* if (t_pad.rJoyV <= 50 && verticalLevel > 25.0F) verticalLevel -= 0.9F;