【问题标题】:Camera moves on mouse orbit相机在鼠标轨道上移动
【发布时间】:2015-08-29 03:03:32
【问题描述】:
function LateUpdate () {   
if (isCameraInputIgnored() ) {
        return;
}   

if (target && Input.GetMouseButton(0)) {
    x += Input.GetAxis("Mouse X") * xSpeed * 0.02;
    y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;

    y = ClampAngle(y, yMinLimit, yMaxLimit);

    var rotation = Quaternion.Euler(y, x, 0);

    var position = rotation * Vector3(0.0, 10.0, -distance) + target.position;

    transform.rotation = rotation;
    transform.position = position;
}
}

这是旋转我的对象的函数。当我点击播放并单击鼠标时(无论我在屏幕上的哪个位置),我的相机正在通过设置来改变它的位置。关于如何阻止它的任何想法?

我添加了 2 张图片以获取详细信息。我希望了解我的问题。

【问题讨论】:

    标签: unity3d


    【解决方案1】:

    我通过更改检查器中的相机位置来解决它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-02
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 2011-06-02
      • 1970-01-01
      相关资源
      最近更新 更多