Camera rotates unmeant around z axis for 180 degrees.

Oct 18, 2012 at 12:06 PM
Edited Oct 18, 2012 at 12:07 PM

Hi,

I have the following function 

  private void MoveToDoubleClick(Point3D doubleClickedTarget)
        {
            doubleClickedTarget.Z += 10;
            CameraHelper.AnimateTo(myCamera, doubleClickedTarget, new   Vector3D(0, 0, -1), myCamera.UpDirection, 1000);
}

 

And only in some situationes the camera rotates for 180 degrees around the z axis. How is this possible? Thanks for help in advance.

Oct 22, 2012 at 7:49 AM
Edited Oct 22, 2012 at 7:50 AM

Changed it to 

   private void animateToTargetPosition(Point3D hitPoint)
        {
            #region Code from Helix lib
            Vector3D newUpDirection = _cam.UpDirection;
            Vector3D newRightVector = Vector3D.CrossProduct(_cam.LookDirection, _cam.UpDirection);
            newRightVector.Normalize();
            Vector3D modUpDir = Vector3D.CrossProduct(newRightVector, _cam.LookDirection);
            modUpDir.Normalize();
            #endregion
            double distance = GeoMath.GeoMathUtils.LineDistance3D(_cam.Position, hitPoint);
            hitPoint.Z += 10;
            CameraHelper.AnimateTo(_cam, hitPoint, new Vector3D(0, 0, -1), modUpDir, StaticUtils.GetAnimationTime(distance));
           
        }