Panning resets focal point

classic Classic list List threaded Threaded
5 messages Options
adrianj adrianj
Reply | Threaded
Open this post in threaded view
|

Panning resets focal point

Hello,

I have an object that is 2000m above the earths surface. I can set the focal point to the object and easily rotate around the focal point, looking at the object from all sides. The moment I pan in any direction or zoom in/out using osgEarth built in panning functionality, the focal point is set to the projected position on the earths surface. After that, when I rotate I am rotating around a different focal point.

Is there a way to disable this kind of focal point resetting? If I zoom in/out I would like the focal point to stay the same. If I pan then I would like the focal point to move relatively to the transition.

I see there used to be an old API that tethered a point and was replaced by setViewpoint. I currently use setViewpoint so set the focal point but it does not tether the point.

Many thanks for your help!

Adrian
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Panning resets focal point

Adrian,
The behavior you describe only works when you are tethered to a Node.
Call Viewpoint::setNode to tether to a node instead of a GeoPoint.
Glenn Waldron / Pelican Mapping
Blanky Blanky
Reply | Threaded
Open this post in threaded view
|

Re: Panning resets focal point

Hey Glenn,

Would you ever plan on making it possible to tether to a GeoPoint, like we do currently for a node, such that it performs the same behavior as tethering to a node?

- Blanky
Josiah425 Josiah425
Reply | Threaded
Open this post in threaded view
|

Re: Panning resets focal point

You can tether to a GeoPoint by just setting the earth manipulator's viewpoint's focal point to your geopoint in mind.  This can be going off in some sort of event handler to simulate tethering to that geopoint such that you can only zoom in and out from it and can't pan when locked in.
adrianj adrianj
Reply | Threaded
Open this post in threaded view
|

Re: Panning resets focal point

In reply to this post by gwaldron
Thank you!

Using SetNode does exactly what I want and always locks the display to the node point.

        Viewpoint vp = _manip->getViewpoint();
        vp.setNode(_tether);
        _manip->setViewpoint(vp, duration);

If I set the SetNode to NULL then the original behavior takes over and a GeoPoint is used.