After played an animation how to update character position?

Hi all, I am quite new for Unity and my game is a 3rd person view game. My controller is PlayerRelativeControl in Unity, after my character collide a collider it will play a wallrun animation, but the wallrun animation will be loop even I have changed it to once in wrap mode, also, the character position cannot be updated which is supposed on the destination after wallrun. Below is my code:

var canAnimate:boolean = false;
var animationTarget : Animation; 


function OnTriggerEnter(coll:Collider){
    canAnimate = true;
}

function OnTriggerExit(coll:Collider){
    canAnimate = false;
}

function Update(){
    if(canAnimate){
	animationTarget.Play("wallrun");
        	
}

Thanks in advance for any kindly advice :wink:

`var canAnimate:boolean = false;
var animationTarget : Animation;
var PlayerPos : Vector3

function OnTriggerEnter(coll:Collider){
canAnimate = true;
}

function OnTriggerExit(coll:Collider){
canAnimate = false;
}

function Update(){
if(canAnimate)
{
animationTarget.Play(“wallrun”);
}
else if (animationTarget.IsPlaying)
{
PlayerPos = animationTarget.transform.position;
}
}`
Hope this works, if not please tell me :slight_smile:

Sorry Edit to before this is the real code SORRY :slight_smile:
`


var canAnimate:boolean = false;
var animationTarget : Animation;
var playerpos : Vector3;

function OnTriggerEnter(coll:Collider){
canAnimate = true;
}

function OnTriggerExit(coll:Collider){
canAnimate = false;
}

function Update(){
if(canAnimate){
animationTarget.Play(“wallrun”);
}
if animationTarget.IsPlaying(“wallrun”);
{
else
playerpos = gameObject.transform.position;
}
}
`