Controlling two independent animations

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By The_Hexagon

I’m new to godot and have to animations that I want to control independently (button [A]&[A1] rotates bone [A] and button [B]&[B1] rotates bone [B]) I’m making the rotations by manipulation the blend value in a AnimationTree blend root node but when I try to use a separate tree for bone A and B only one of them work I tried using a state machine with blend nodes but couldn’t get it to work, any help would be great!

extends KinematicBody

var velocity = Vector3()
var accel
var new_pos
var tiltAnim

var player
var angle
var finPos = 0.5
var rudderPos = 0.5
var currentVelocity
var rotSpeed = 1
var tilt = 0



const SPEED = 6
const ACCELERATION=2
const DE_ACCELERATION = 4



func _ready():
	
	player = get_node(".")
	tiltAnim =get_node("AnimationPlayer/tilt")
func _physics_process(delta):
	var dir = Vector3()
	angle=player.get_global_transform().basis
	
	
	
	
	if(Input.is_action_pressed("tilt_up") && finPos>0):
		finPos-=0.01
	elif(Input.is_action_pressed("tilt_down") && finPos<1):
	
		finPos+=0.01
	elif(finPos!=0.5):
		if(finPos>0.5):
			finPos-=0.01
		else:
			finPos+=0.01
	if(Input.is_action_pressed("rotate_left") && rudderPos>0):
		rudderPos-=0.01
	elif(Input.is_action_pressed("rotate_right") && rudderPos<1):
		rudderPos+=0.01
	elif(rudderPos!=0.5):
		if(rudderPos>0.5):
			rudderPos-=0.01
		else:
			rudderPos+=0.01
			
	if(!Input.is_action_pressed("move_bck") or !Input.is_action_pressed("move_frwd")):
		
			
		if(Input.is_action_pressed("move_frwd")):
			dir+= angle.z
			#dirBool=true

		
		if(Input.is_action_pressed("move_bck")):
			dir-=angle.z
			#dirBool=false
		
		if(Input.is_action_pressed("move_up")):
			dir.y+=2
		if(Input.is_action_pressed("move_down")):
			dir.y-=2
	
	dir=dir.normalized()
	
	
	
	accel = DE_ACCELERATION
	new_pos=dir * SPEED
	if(dir.dot(velocity)>0):
		accel=ACCELERATION
	velocity=velocity.linear_interpolate(new_pos, accel * delta)

	var test=velocity*velocity
	currentVelocity = sqrt(test.x+test.y+test.z)
	velocity = move_and_slide(velocity, Vector3(0,0,0))

	var rotation= Vector3(0,0,0)
	rotation.y=-currentVelocity*(rudderPos-0.5)*rotSpeed*delta
	var buff=currentVelocity*(finPos-0.5)*rotSpeed*delta
	
	if(tilt+buff>-0.79 and tilt+buff<0.79):
		rotation.x=-buff
		tilt+=buff
		#print(tilt+buff)

		

	
	
	player.set_rotation(player.get_rotation()+rotation)
	
	
	$AnimationPlayer/tilt.set("parameters/tilt/blend_amount", finPos)
	$AnimationPlayer/turn.set("parameters/turn/blend_amount", rudderPos)