Spin globe only left/right

Jun 12, 2010 at 1:31 AM

hi all--

is there a way to prevent the globe/map from being spun/moved up/down, so it would function like a traditional globe (where it only spins on the axis that goes through the north and south poles)?

i tried restricting the mouse positions, and it works to some extent, but fails if you start dragging outside, etc.

thanks!

jon

Coordinator
Jun 21, 2010 at 4:45 PM

Did you modify (or override) the DoControlInputMove and DoMapMove other similar methodsto restrict the mouse position?

Are you using mouse or touch?

Another option might be to watch for camera changes in the CameraChanged event then reset the pitch every time. I haven't tested that and it might produce flickering, though. Also if you navigate in a particular way (such as not looking straight down) this may not work.

Jun 21, 2010 at 5:34 PM

ahh thanks! fiddling with DoControlInputMove works much better -- movement is correctly constrained, but let's say i'm dragging up and to the left. the globe still spins left, but once i release, the inertia still causes the globe to spin up. i can't figure out where to change that. i've tried DoControlInputMove, DoControlInputDown, and DoControlInputUp. (i basically just set Y=0 on the MouseEventArgs.)

am i going about it the wrong way?

(btw, i'm using mouse).

thanks!

jon

Coordinator
Jun 21, 2010 at 5:40 PM

Interesting. Not sure why the inertia would still happen. The GlobeControl handles mouse inertia internally.

Try the CameraChanged trick.

Jun 21, 2010 at 6:31 PM

hmm yes, it flickers quite a bit (to the point of being unusable, but also doesn't seem to be working correctly) -- is there a better way to reset it? (i'm sure i'm setting things incorrectly).

i tried just the roll/pitch/yaw, but that didn't seem to help, so i thought maybe i have to set the latitude to 0 too?

void globe_CameraChanged(object sender, VECameraChangedEventArgs e)
        {
            globe.Roll = 0;
            globe.Pitch = -90;
            globe.Yaw = 0;

            //globe.Altitude = 15000000;

            globe.JumpTo(new VELatLong(0, e.NewLatLong.Longitude), 0, -90, 0, globe.Altitude);
        }

 

 

 

 

Coordinator
Jun 21, 2010 at 8:40 PM
Try something along these lines: http://blogs.msdn.com/b/virtualearth3d/archive/2009/08/07/constraining-camera-movement.aspx
Jun 21, 2010 at 8:51 PM

worked like a charm! thanks!

 

jon