我正在开发一款相机跟随汽车的游戏。代码是跟着车走的,但是在整个环境中都表现出抖动。
void LateUpdate()
{
Vector3 lookOnObject = Player.position - transform.position;
transform.forward = lookOnObject.normalized;
Vector3 playerLastPosition;
playerLastPosition = Player.position - lookOnObject.normalized * distanceFromObject;
playerLastPosition.y = Player.position.y + distanceFromObject / 2;
transform.position = playerLastPosition;
}