【问题标题】:Character rotate at collider with camera script角色在带有相机脚本的对撞机处旋转
【发布时间】:2018-09-19 14:27:08
【问题描述】:

我正在使用一个简单的脚本让相机跟随玩家目标。

// Use this for initialization
void Start()
{
    //Calculate and store the offset value by getting the distance between the player's position and camera's position.
    offset = transform.position - player.transform.position;
}

// LateUpdate is called after Update each frame
void LateUpdate()
{
    // Set the position of the camera's transform to be the same as the player's, but offset by the calculated offset distance.
    transform.position = player.transform.position + offset;
}

但是当我开始游戏时,玩家开始旋转并在第一次碰到对撞机时忽略对撞机。

在我将此脚本放在播放器上后,这开始发生。我什至尝试冻结旋转,但如果我冻结旋转,我无法用动画旋转我的播放器。我该如何解决这个问题?

【问题讨论】:

    标签: c# unity3d


    【解决方案1】:

    将此脚本附加到“相机”而不是“播放器”,您应该没问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多