Triggering an animation via distance

Hi there,

Please be aware that im a complete unity noob so please talk to me like an idiot.
I was wondering how i could trigger an animation on an object by coming into close proximity to that object.
The animation along with the modeling has been done in 3ds max.

Here’s something to get you started. Attach this JavaScript to your player and mess around with it… the target is the object you want to have distance between your player. The detectRange is a variable to determine the distance between the player and the target at which the animation will be triggered.:

var target : Transform;
var dodecahedron : GameObject;
var detectRange: float = 30;

function Update() {
var tgtDirection = target.position - transform.position;  
var tgtDistance = tgtDirection.magnitude;
if (tgtDistance <= detectRange) {

Hope this helps you.