Hi, I made a little follow script for a flying game and it works just fine, however camera movement gets rather choppy. I can lower the smooth parameter to make it less choppy, but doing so means the camera will follow way to slow. Does anyone know of a way to fix this choppyness?
Here’s my current script:
#pragma strict
var player: GameObject;
var target : Transform; //this is a node behind my aircraft, not the same as player...
var oldPos: Vector3;
var newPos: Vector3;
var smooth: float = 5;
function Awake()
{
player = GameObject.FindWithTag("Player");
oldPos = transform.position;
newPos = target.position;
}
function LateUpdate()
{
oldPos = transform.position;
transform.rotation = player.transform.rotation;
transform.position = Vector3.Lerp(oldPos, newPos,Time.deltaTime * smooth);
newPos = target.position;
}