View Single Post
Old 03-01-2006   #5 (permalink)
Jason [Mobiform]


 
 

Re: Rotating the PerspectiveCamera

Maybe this is a recent addition, but RotateTransform3D.Transform does seem
to accept Vector3D and Vector3D[].

Jason

"Kevin Hoffman" <alothien@gmail.com> wrote in message
news:1141154351.928956.174110@u72g2000cwu.googlegroups.com...
> Ok... I've got a scene where my camera is above (Y+) and away from (Z+)
> my 3D object. I can move the camera toward the object by doing this:
>
> camera.Position += camera.LookDirection;
>
> I find that quite handy, really intuitive, and brings back fond
> memories of Vector study in Physics class in college
>
> What I want is to be able to 'turn' the camera to the left or to the
> right. At first glance, I thought I might just increment or decrement
> the X value of the LookDirection... the problem is you get an
> "approaches infinity" type of foreshortening effect there - as you turn
> more and more left, the effect becomes more and more off because you're
> still looking at a point off in the distance at the X axis, not
> actually turning the camera the way it should be.
>
> What I _think_ I should be doing is applying a 3D Axis rotation where I
> rotate X degrees negative about the Y axis when turning the camera
> left, and X degrees positive about the Y axis in order to spin the
> camera to the right.
>
> What I can't quite figure out is how to accomplish a transform of the
> Unit Vector indicating my LookDirection. I've tried creating a
> RotateTransform3D based on an AxisAngleRotation3D as follows:
>
> RotateTransform3D cameraSpinner = new RotateTransform3D(
> new AxisAngleRotation3D(new Vector3D(0,1,0), -10));
>
> In my newbie little brain, this should create a transformer that will
> rotate something about the Y axis (the 0,1,0 unit vector) to the 'left'
> 10 degrees.
>
> The problem is the RotateTransform3D only operates on a Point3D or an
> array of Point3Ds... so how does one Transform the LookDirection vector
> by rotating the LookDirection of the camera about the Y axis?
>
> I'm sure this is something totally trivial and I'm missing it because
> I'm a complete newbie, but I would love for someone's input on how to
> accomplish this..
>
> Thanks,
> Kevin
>



My System SpecsSystem Spec