三维场景中的旋转,是摄像机本身在世界坐标系中绕Y轴进行旋转,从而改变位置,而其他的姿态不变,也就是摄像机的Position向量绕着世界坐标系的Y轴进行旋转。

三种方式:

1,采用角度(不通用),此方法适合目标点是世界坐标系原点。

 

float angleFirst = 0;
private void RotateYFirst(float paAngle)
{
   //通过角度
   angleFirst += paAngle;
   if (angle > 6.28f)
   {
       angle -= 6.28f;
   }
   camPosition = new Vector3(4 * (float)Math.Cos(angleFirst), 0, 4 * (float)Math.Sin(angleFirst));
   Matrix view = Matrix.LookAtLH(camPosition, camTarget, camUp);
   device.SetTransform(TransformType.View, view);
}

相关文章:

  • 2021-07-13
  • 2021-09-08
  • 2022-01-12
  • 2022-12-23
  • 2022-03-10
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
  • 2021-08-29
  • 2021-12-31
  • 2022-02-22
  • 2022-12-23
相关资源
相似解决方案