Compartilhar via


Camera Tricks

Just a couple camera nuggets to drop today.  The code snippets below were all written inside JumpHandler in the Camera sample, replacing the SetValues and Current = jumpController calls.  Incidentally, sorry about the rpw typo in there.

Want to make FlyTo faster or slower?

CameraParameters param = new CameraParameters();
param.Speed = 2.0; // makes it twice as fast, 0.5 makes it half as fast, etc
lla.Altitude = 0;
this.Host.Navigation.FlyTo(lla,
rpw.Pitch * Constants.DegreesPerRadian,
rpw.Yaw * Constants.DegreesPerRadian,
 false,
param);
 

To make it effectively instant, use a large value like 1000.

How about flying directly to a target without the arcing movements?

GeodeticViewpoint vp = new GeodeticViewpoint();
vp.Position.Location = lla;
vp.LocalOrientation.RollPitchYaw = rpw;
DirectAnimatedCameraController dac = new DirectAnimatedCameraController(this.Host);
this.Host.CameraControllers.Current = dac;
dac.MoveTo(vp, this.Host.CameraControllers.Default);

and if you want buildings in the way to fade out and not block you, call this right before the MoveTo:

dac.TransparentViewRay = true;