Scripting Animation to Android camera relative controller

hey there well soo far i was able to script my left joystick to handle all my run animations but iam having trouble setting up the right joystick soo that it controls the look left.right,up,down movement’s… iam able to do most of my functions like fire relode ect, but just stuck on that right joystick… here is what the code looks like soo far

var reload:AnimationState;
var swap:AnimationState;
var fire:AnimationState;
var hit:AnimationState;
var up:AnimationState;
var down:AnimationState;
var right:AnimationState;
var left:AnimationState;

function Start(){
//NotificationCenter.DefaultCenter().AddObserver(this,"");
//NotificationCenter.DefaultCenter().AddObserver(this,"");
NotificationCenter.DefaultCenter().AddObserver(this, "Gameover");
NotificationCenter.DefaultCenter().AddObserver(this, "Reload");
NotificationCenter.DefaultCenter().AddObserver(this, "SwapWeapon");
NotificationCenter.DefaultCenter().AddObserver(this, "Fire");
NotificationCenter.DefaultCenter().AddObserver(this, "FireShotgun");
NotificationCenter.DefaultCenter().AddObserver(this, "PlayerHit");

reload = animation["reload"];
reload.layer = 1;
reload.blendMode = AnimationBlendMode.Additive;

swap = animation["swap"];
swap.layer = 1;
swap.blendMode = AnimationBlendMode.Additive;

fire = animation["fire"];
fire.layer = 1;
fire.blendMode = AnimationBlendMode.Additive;

hit = animation["hit"];
hit.layer = 1;
hit.blendMode = AnimationBlendMode.Additive;

}
var isDead:boolean = false;

function Gameover(){
isDead = true;
animation.CrossFade("death",0.1);
}

function Reload(){
animation.CrossFade("reload",0.1);
}

function SwapWeapon(){
animation.CrossFade("swap");
}

function Fire(){
animation.CrossFade("fire",0.1);
}

function FireShotgun(){
animation.CrossFade("fire",0.1);
}

function PlayerHit(){
animation.CrossFade("hit",0.1);
}

var JoystickScriptMove:Joystick;
var JoystickPosMove:Vector2;
var JoystickScriptRotate:Joystick;
var JoystickPosRotate:Vector2;

function Update () {
if (!isDead) {
//Debug.Log(JoystickScriptMove.position);
//Debug.Log(JoystickScriptRotate.position);
JoystickPosMove = JoystickScriptMove.position;
JoystickPosRotate = JoystickScriptRotate.position;


if (JoystickPosRotate.y > 0.4) {
up = animation["up"];
up.layer = 1;
up.blendMode = AnimationBlendMode.Additive;
animation.CrossFade("up");
} else if (JoystickPosRotate.y < -0.4) {
down = animation["down"];
down.layer = 1;
down.blendMode = AnimationBlendMode.Additive;
animation.CrossFade("down");

} else if (JoystickPosRotate.x > 0.4) {
right = animation["right"];
right.layer = 1;
right.blendMode = AnimationBlendMode.Additive;
animation.CrossFade("right");

} else if (JoystickPosRotate.x < -0.4) {
left = animation["left"];
left.layer = 1;
left.blendMode = AnimationBlendMode.Additive;
animation.CrossFade("left");
}


if (JoystickPosMove.y > 0.4) {
animation.CrossFade("forward");
} else if (JoystickPosMove.y < -0.4) {
animation.CrossFade("backwards");
} else if (JoystickPosMove.x > 0.4) {
animation.CrossFade("rightStraff");
} else if (JoystickPosMove.x < -0.4) {
animation.CrossFade("leftStraff");
} else {
animation.CrossFade("idle");
}

}

}

Edit > Project Settings > Input?

It looks like the problem is in Joystick, not this file.

well i figured it out my script was correct but i just needed to clamp forever my animations then it worked perfect… then just changed the animation layers then worked like a charm hope that script helps others :slight_smile: