public class CameraFallow : MonoBehaviour {
public Transform playerTransform;
private Vector3 offset;
// Use this for initialization
void Start()
{
offset = transform.position - playerTransform.position;
}
// Update is called once per frame
void Update()
{
//transform.position = Vector3.SmoothDamp(playerTransform.position, playerTransform.position + offset, ref cameraVelocity, smoothTime);
transform.position = playerTransform.position + offset;
}
}
一个2D工程,想让摄像机跟随人物,但是写了之后,发现画面会有轻微闪烁,一顿一顿的,而且UI如果跟随移动的话也会出现模糊的情况,在某些特定位置还会卡一下,摄像机代码如上图