Rotate the camera
#1
Hi,

I´ve successfully realized the Rotation of a camera by code:

Code:
var rotateTransform3D = new RotateTransform3D { CenterX = 0, CenterZ = 0 };
            var axisAngleRotation3D = new AxisAngleRotation3D { Axis = new Vector3D(0, 1, 0), Angle = Convert.ToDouble(Slider2.Value) };
            rotateTransform3D.Rotation = axisAngleRotation3D;
            _robotArmReader3ds.Cameras[0].Transform = rotateTransform3D;

I´m using a slider to set the rotation angle.
I want to rotate all 3 axes of the camera:

Therefore I implemented 3 slides with the following codes:
Rotating x-axis:
Code:
var rotateTransform3D = new RotateTransform3D { CenterX = 0, CenterZ = 0 };
            var axisAngleRotation3D = new AxisAngleRotation3D { Axis = new Vector3D(1, 0, 0), Angle = Convert.ToDouble(Slider1.Value) };
            rotateTransform3D.Rotation = axisAngleRotation3D;
            _robotArmReader3ds.Cameras[0].Transform = rotateTransform3D;

Rotating y-axis:

Code:
var rotateTransform3D = new RotateTransform3D { CenterX = 0, CenterZ = 0 };
            var axisAngleRotation3D = new AxisAngleRotation3D { Axis = new Vector3D(0, 1, 0), Angle = Convert.ToDouble(Slider2.Value) };
            rotateTransform3D.Rotation = axisAngleRotation3D;
            _robotArmReader3ds.Cameras[0].Transform = rotateTransform3D;

And rotating z-Axis:
Code:
var rotateTransform3D = new RotateTransform3D { CenterX = 0, CenterZ = 0 };
            var axisAngleRotation3D = new AxisAngleRotation3D { Axis = new Vector3D(0, 0, 1), Angle = Convert.ToDouble(Slider3.Value) };
            rotateTransform3D.Rotation = axisAngleRotation3D;
            _robotArmReader3ds.Cameras[0].Transform = rotateTransform3D;

The problem is, that I rotate the x-axis by 30°. Than I rotate the y-axis by 20°. Now, the rotation of the x-axis is resetted to 0° first and the the y-Axis.
How can I rotate all 3axis by 3 sliders, without resetting axis?

michael
  


Messages In This Thread
Rotate the camera - by mibe - 01-16-2014, 03:50 PM
RE: Rotate the camera - by abenedik - 01-22-2014, 03:21 PM
RE: Rotate the camera - by mibe - 02-06-2014, 11:47 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)