Feature/anchor and aim (#799)

Introduce the ability to navigate using an anchor and aim.
Example use: Set spacecraft as anchor and planet as aim to always look down at a planet, while followin the spacecraft in its orbit.
This commit is contained in:
Emil Axelsson
2019-02-19 18:46:58 +01:00
committed by GitHub
parent df9fbf8195
commit 2e71eaa4cb
45 changed files with 972 additions and 490 deletions
+5 -3
View File
@@ -585,20 +585,22 @@ const std::string& ParallelPeer::hostName() {
}
void ParallelPeer::sendCameraKeyframe() {
SceneGraphNode* focusNode = global::navigationHandler.focusNode();
const SceneGraphNode* focusNode =
global::navigationHandler.orbitalNavigator().anchorNode();
if (!focusNode) {
return;
}
// Create a keyframe with current position and orientation of camera
datamessagestructures::CameraKeyframe kf;
kf._position = global::navigationHandler.focusNodeToCameraVector();
kf._position = global::navigationHandler.orbitalNavigator().anchorNodeToCameraVector();
kf._followNodeRotation =
global::navigationHandler.orbitalNavigator().followingNodeRotation();
if (kf._followNodeRotation) {
kf._position = glm::inverse(focusNode->worldRotationMatrix()) * kf._position;
kf._rotation = global::navigationHandler.focusNodeToCameraRotation();
kf._rotation =
global::navigationHandler.orbitalNavigator().anchorNodeToCameraRotation();
}
else {
kf._rotation = global::navigationHandler.camera()->rotationQuaternion();