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");
}
`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