Panning Camera by changing target

Dec 2, 2009 at 7:39 PM

I am trying different interactive ways to change the camera position and target.  Zooming in and out was no problem, but I am having trouble isolating how to transform the Camera.Target values dynamically.  It was straight forward to connect the relative position of zooming the Camera by changing its position.  Now I am trying to keep the position constant and change the target. 

Has anyone done this?  Can you suggest a method?

Dec 2, 2009 at 8:26 PM
Edited Dec 2, 2009 at 8:27 PM

The Camera has a Target property which is a Vector, all its components can be manipulated. If you're doing this from Xaml, you can actually storyboard it, something like this: 


   xmlns:x="" xmlns:local="clr-namespace:Balder.Silverlight.TestApp" >


 <Storyboard x:Name="_cameraStoryboard">
 <EasingDoubleKeyFrame KeyTime="00:00:00" Value="5" >
 <CircleEase EasingMode="EaseOut"/>
 <EasingDoubleKeyFrame KeyTime="00:00:02" Value="0" >
 <CircleEase EasingMode="EaseIn"/>

 <Grid x:Name="LayoutRoot">

 <balder:Game x:Name="_game" Width="800" Height="600" DebugLevel="BoundingSpheres">
 <balder:Mesh x:Name="_teapot"  AssetName="teapot.ASE"/>





Dec 2, 2009 at 9:16 PM
Edited Dec 2, 2009 at 9:17 PM

Also worth mentioning, is that Tutorials are now bubbling up on the site: 

You'll find them here

Dec 3, 2009 at 3:42 PM

I treid this, attaching it to the left mouse button down event of a slider.  Event never fired.  I have the event wired in the mainpage.xaml and my calback is in mainpage.xaml.cs files.

 I think I am missing something in defining the left mouse button event.  Do I need to define it within the xaml code for the game and game class?

Dec 5, 2009 at 2:42 PM

Sorry for the late answer - missed this post. 

For a Slider, I'd go with the ValueChanged event. 

As for the left mouse button event - I can't see why this shouldn't work. Would it be possible for you to send me a sample that doesn't work ?