【发布时间】:2021-05-25 11:52:18
【问题描述】:
基本上,我的 fps 播放器上有两个枪物。真枪和玩家看到的枪。我有一个关于枪的脚本,玩家看到它通过插值跟随作为相机子级的真枪的位置和旋转。
旋转没问题,但枪的位置让我感到不安。这是我在玩家看到的枪上的平滑移动脚本:
public Transform target; //The gun that the player doesn't see
public float moveSpeed = 0.125f;
public float rotateSpeed = 0.125f;
void LateUpdate()
{
//this is causing the jittery motion
transform.position = Vector3.Lerp(transform.position, target.position, moveSpeed);
//this is very smooth
transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, rotateSpeed);
}
有人知道为什么吗?
【问题讨论】:
-
您能否确认
moveSpeed和rotateSpeed的值与Inspector 中配置的值匹配? -
@derHugo 是的,他们匹配
标签: unity3d interpolation