How to fix ai floating when chasing?

Here’s my AI script var chaseRange = 15.0;var attackRange = 1.5;var moveSpeed = 5.0;var Dampin - Pastebin.com

Here’s a video to what the problem looks like. http://videobam.com/FAnev

And it’s just, when I jump the model follows me and I don’t know how to get physics to ably to the character controller. I’d really appreciate some answer. I’ve been stuck for 2 weeks now. (And yes I’m new to programming and Unity(I’m studying up on JavaScript))

When your character jumps the Quaternion.LookRotation would return X and prehaps even Z rotations to compensate for the height difference, the only axis you need is Y.

This would fix it:

function lookAt ()
{
        renderer.material.color = Color.yellow;
        var rotation = Quaternion.LookRotation(Target.position - transform.position);
        rotation.x = 0;
        rotation.z = 0;
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping);

}