Does anyone know of a script that is like the smooth follow script except it follows all axis? I’m making a aircraft game in third person, and I want the camera to stay behind the aircraft no matter which way it turns. I could of course parent the camera to the airplane but there would be no smoothing whatsoever.
I tried just duplicating the code inside of the smooth follow script and changing the areas where it references position.y and eularangles.y to the X axis instead. but it does not seem to be working.
Hey, nice script. It comes close to what i’m looking for. Didn’t know it could be done with such little code. However, when I tried using it for my airplane, when the airplane rolls, the camera does not roll with it. Also, when the aircraft turns in a loop, the camera flips around. I want the camera to generally stay behind the aircraft at all times, with a smooth factor.
After working with it for awhile, I was able to get a script that would not flip when the plane does a loop. Its a pretty short script. However, I ran into another problem. When the airplane is in flight, the camera shakes tremendously. How can I fix this?
Below is my script for the camera. The target is a gameObject behind the aircraft where I want the position of the camera to rest at.
var target : Transform;
var aircraft : Transform;
var speed = 5.0;
function LateUpdate() {
transform.position = Vector3.Lerp ( transform.position, target.position,Time.deltaTime * speed);
transform.rotation = transform.rotation = Quaternion.Lerp(transform.rotation,aircraft.rotation,speed*Time.deltaTime);
}