How do you tilt while maintaining camera "focus"?

Feb 26, 2010 at 10:12 PM

I am trying to implement a map tilt gesture, but when I fire the DoMapTilt method...the center of the map goes "off screen" and I have to pan back to the point of the map I was previously focused on. How can I tilt the map and still keep the focus on the center of the screen? I've tried adjusting the altitude of the camera, but I get some very undesirable results. I think I have to do *something* with the Camera...but I can't find any MapPoint API documentation so I don't know what is available.

Feb 27, 2010 at 1:14 AM

Hi kdvalin,

The way DoMapTilt works is different from how Surface Globe does tilting. DoMapTilt only changes the camera's local pitch (like an airplane pitches perhaps). Surface Globe does that but also pans at the same time, though there is some complex math in there that I had not figured how yet.

To do a Surface Globe type of behavior there really would need an additional method that has the appropriate math and camera methods. If you want to mess with it, try taking a look at DoMapTilt and DoMapPivot.


Apr 12, 2010 at 9:48 PM

So I "reached out" to Nikolai Faaland (he runs the Virtual Earth 3D team blog) and he figured this out. I told him what I was trying to accomplish and sent him the code I was working with. He figured out that the answer is in the "DoMapPivot" method. He said to make a copy of this method and call it "DoMapPivotUpDown". Then all that is needed is to change a few lines of code in order for it to work.

Comment (or remove) the following lines:

 //Vector3D tempVector = anchor.Vector;
//anchor.Altitude += 10;
//Vector3D axis = Vector3D.Normalize(anchor.Vector - tempVector);

Add the following line of code (it replaces the previous variable called "axis"):

<font size="2" color="#2b91af"><font size="2" color="#2b91af">


</font></font><font size="2" color="#2b91af">



axis = Vector3D.Cross(cameraStep.Camera.Viewpoint.Orientation.LookUp, cameraStep.Camera.Viewpoint.Orientation.LookAt);

That's it! I now have a method that allows me to "tilt" while maintaining focus on the center of the screen (similar to holding down Ctrl key while mouse dragging in Bing Maps 3D). I wired this up to a gesture (palm of the hand + finger drag) and it works like a champ!

May 16, 2013 at 7:54 AM
I tried the code, but no use, can you show the full code of DoMapPivotUpDown??
May 21, 2013 at 1:56 AM
it works, sorry my fault.