我的相机在跟随汽车游戏对象时抖动。有没有办法按照脚本修复我的相机?

问题描述 投票:0回答:0

我正在开发一款相机跟随汽车的游戏。代码是跟着车走的,但是在整个环境中都表现出抖动。

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;     
}
c# unity3d
© www.soinside.com 2019 - 2024. All rights reserved.