tags:

views:

475

answers:

1

If I have a sphere that is being rotate by the users mouse, how could I (at any time, say via a button) apply some rotation transformation on the Camera so that a specific spot on the Sphere is facing the User?

Currently I'm implementing a trackball approach that moves the camera around when the user clicks and drags, and I would like to be able to "Pan" to a specific spot on the Sphere, but I dont know how to calculate the required 3D rotation transformation based on the cameras current position.

Any help here would be greatly appreciated.

Thanks, Mark

+1  A: 

I think you need something like this(it's rather simple you just have to know where do want your camera and where to look, the rest will be taken care of by WPF :-) ):

                 Vector3DAnimation lookAnimation = new Vector3DAnimation(
                    currentLookDirection, nextLookDirection,
                    TimeSpan.FromMilliseconds(1000));

                Point3DAnimation positionAnimation =
                   new Point3DAnimation(currentPosition, nextPosition,
                   TimeSpan.FromMilliseconds(1000));

                mainViewport.Camera.BeginAnimation(
                    PerspectiveCamera.LookDirectionProperty, lookAnimation);
                mainViewport.Camera.BeginAnimation(
                    PerspectiveCamera.PositionProperty, positionAnimation);
sklitzz
thats nice, thanks, I will give it a try some time soon, this functionality requirement was put on the back burner. But if anyone else reads this and confirms that it works, I will be happy to mark it as an answer :)
Mark