Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2015-01-03 20:23:13 +0000
committerStijn Buys <ingar@osirion.org>2015-01-03 20:23:13 +0000
commit57d958d40af061e83aa99ca12e375e5345836ecd (patch)
tree99969fa526093b0be9d944a810908272882e9408 /src/render
parent85671408eed36060f5ff4799f2ee153d66e16282 (diff)
Added freelook support. added +freelook action and set it as default bind for the left mouse button.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/camera.cc9
1 files changed, 9 insertions, 0 deletions
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()) {