Having issues with a smooth camera follow

I’m trying to create a smooth camera follow for a 2.5D game (plays like 2d, is in 3d). Im having issues though as my camera follows the character too well even when I’m pretty sure it shouldnt be (and by shouldn’t I mean I’ve drastically changed the numbers involved to warrant a difference). The translation for both the camera and the character are nearly the same, even when I’ve tried to severely lower or raise the camera speed. Maybe my math or logic is bad but I’ve worked it out several times and it still seems like it should work. Maybe someone can take a look at it for me and offer some advice.

http://pastebin.com/NX88tzcB

First, if you past your code directly into the question (and format it using the 101/010 button), you are likely to get a much better response.

I made a quick pass through your code. It seems like an awfully complicated way to do smooth camera tracking with easing. There may be something specific you are getting out of it that I don’t see. Here is an alternative script that tracks an object on the XY but leaves ‘Z’ alone. It attaches to the camera and expects the tracked object to be named “Player”. But you can take the same logic and integrate into a 3-party script like yours:

#pragma strict

private var player : Transform;
var deadZone = 0.15;
var speed = 1.5;

function Start () {
	player = GameObject.Find("Player").transform;
}

function Update () {
	var v3 = player.position;
	v3.z = transform.position.z;
	if (Vector3.Distance(v3, player.position) > deadZone)
		transform.position = Vector3.Lerp(transform.position, v3, speed * Time.deltaTime);
}

From what I can tell, you are turning the distance to move into an incredibly small number…

It looks like the maximum difference that the camera trails by is .1f (deadZone). You’re then taking .1f^camSpeedCoef, which turns it into .0000000001f.

Multiplying the character’s speed by Time.deltaTime ensures that you’re getting fractional numbers unless the speed is very high.