mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 19:29:04 -05:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user