From 57d958d40af061e83aa99ca12e375e5345836ecd Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 3 Jan 2015 20:23:13 +0000 Subject: Added freelook support. added +freelook action and set it as default bind for the left mouse button. --- src/render/camera.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/render') diff --git a/src/render/camera.cc b/src/render/camera.cc index ba9c367..881d9ae 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -263,7 +263,12 @@ void Camera::frame(float seconds) float cosangle; // cosine of an angle float angle; // angle in radians math::Vector3f n; // normal of a plane + + // freelook target + target_axis.change_direction(90 * target_direction); + target_axis.change_pitch(90 * target_pitch); + // rotate scene axis towards target axis n.assign(math::crossproduct(camera_scene_axis.forward(), target_axis.forward())); if (!(n.length() < MIN_DELTA)) { n.normalize(); @@ -324,6 +329,10 @@ void Camera::frame(float seconds) } else if (mode() == Cockpit) { + // freelook target + target_axis.change_direction(90 * target_direction); + target_axis.change_pitch(90 * target_pitch); + camera_scene_axis.assign(target_axis); if (core::localcontrol()->model()) { -- cgit v1.2.3