C# 使用摄影机脚本在碰撞器处旋转角色
我使用一个简单的脚本让相机跟随玩家的目标C# 使用摄影机脚本在碰撞器处旋转角色,c#,unity3d,C#,Unity3d,我使用一个简单的脚本让相机跟随玩家的目标 // 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; }
// 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;
}
但当我开始游戏时,玩家开始旋转,并在第一次击中对撞机时忽略对撞机
这是在我把这个脚本放到播放器上之后开始的。我甚至试图冻结旋转,但如果我冻结旋转,我就不能用动画旋转我的播放器。如何修复此问题?将此脚本附加到“相机”而不是“播放器”,您应该会没事的