   Simple rotation prolem
  Hi all,I have a problem rotating an object. I am using quaternions to do it. For the most part it works well but when the angle goes from 359 to 1 or from 1 to 359 the rotation goes the long way around. Does anyone know how to prevent this? I''ve supplied the code below, note although I am working in degree converting to radians shouldn''t have any effect since principally they are the same.CheersDRb2k2   VOID CMediumObjectDetails::CalculateMeshRotation(D3DXVECTOR3 CameraPosition){CameraPosition.z = CameraPosition.z - this->m_vCurrentPosition.z;CameraPosition.x = CameraPosition.x - this->m_vCurrentPosition.x;D3DXVECTOR3 TempMeshPos = this->m_vCurrentPosition;TempMeshPos.z = 0.0f;TempMeshPos.x = 0.0f; // = 0// get the vector of a position on the far side of meshD3DXVECTOR3 Line;D3DXVec3Subtract(&Line, &TempMeshPos, &CameraPosition);D3DXVec3Add(&Line, &Line, &TempMeshPos);Line.y = 0;D3DXVec3Normalize(&Line,&Line);D3DXVECTOR3 LookingAt(0,0,-1);D3DXVec3Normalize(&LookingAt, &LookingAt);//check to see which direction to rotate inD3DXVECTOR3 Cross;float dotproduct;dotproduct = D3DXVec3Dot(&Line, &LookingAt);D3DXVec3Cross(&Cross,&Line,&LookingAt);//calculate angle in degreesdotproduct = (float)acos(dotproduct);dotproduct = D3DXToDegree(dotproduct);//convert to 360 degreesif(Cross.y >=0.0f)this->m_vRequiredRotation.y = 360.0f-dotproduct;elsethis->m_vRequiredRotation.y =  dotproduct;// now see if any rotation needs to be doneif(this->m_vRequiredRotation != this->m_vCurrentRotation){// now calculate the quaternion rotationD3DXQUATERNION Current,Required;Current.x = this->m_vCurrentRotation.x;Current.y = this->m_vCurrentRotation.y;Current.z = this->m_vCurrentRotation.z;Required.x = -this->m_vRequiredRotation.x;Required.y = -this->m_vRequiredRotation.y;Required.z = -this->m_vRequiredRotation.z;D3DXQUATERNION Result;D3DXQuaternionSlerp(&Result, &Current, &Required, 0.5f);this->m_vCurrentRotation.x = Result.x;this->m_vCurrentRotation.y = Result.y;this->m_vCurrentRotation.z = Result.z;}}