How to play multiple animations at once?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 1997
:warning: Old Version Published before Godot 3 was released.

I’m trying to animate my spaceship’s 3rd person camera similar to this.
( https://www.youtube.com/watch?v=ijh-n-ntImA ) however the animations only play one at a time so it ends up looking very choppy. there are four animations for up, down, left and right which just move the camera a bit in those directions. I need to get the animations to blend with each other(for example up and left at the same time), and when when the ship stops turning have the camera smoothly slide back.

this is the code for the movement part.

extends RigidBody

var speed = 1
var isshooting = false
var laserCount = 0
var laser = preload("res://assests/models/laser/laser.scn")
var laserArray = []
var up = false
var down = false
var left = false
var right = false


func _ready():

   set_fixed_process(true)
   set_gravity_scale(0)

func _fixed_process(delta):

if Input.is_action_pressed("ui_accelerat"):
	speed = speed + .1

if Input.is_action_pressed("ui_decelerate"):
	speed = speed - .1

if Input.is_action_pressed("ui_up"):
	get_node("Ship").rotate_x(delta/.8)
	if up == false:
		get_node("Ship/Camera/AnimationPlayer").play("up")
		up = true
else:
	up = false
if Input.is_action_pressed("ui_down"):
	get_node("Ship").rotate_x(-delta/.8) 
	if down == false:
		get_node("Ship/Camera/AnimationPlayer").play("down")
		down = true
else:
	down = false
if Input.is_action_pressed("ui_left"):
	get_node("Ship").rotate_z(delta/.7) 
	if left == false:
		get_node("Ship/Camera/AnimationPlayer").play("left")
		left = true
else:
	left = false
if Input.is_action_pressed("ui_right"):
	get_node("Ship").rotate_z(-delta/.7) 
	if right == false:
		get_node("Ship/Camera/AnimationPlayer").play("right")
		right = true
else:
	right = false

if speed > 10:
	speed = 10
get_node("Ship").translate(Vector3(0,0,delta*speed))

I guess you need AnimationTreePlayer.
https://www.youtube.com/watch?v=3xxUt3iABgA
This might help.

volzhs | 2016-05-06 18:58

:bust_in_silhouette: Reply From: 1997

Well after days of frustration, I’ve solved by problem with coding. However I can say that yes you can play multiple animations at once with animationtreeplayer, it was wasn’t what I was looking for. animationtreeplayer is very helpful if you want to switch from animation to animation very nicely. but not play four animations at once the way I wanted. if you want to how I did it with code go here.

:bust_in_silhouette: Reply From: twinpixel

Did you try using the tween class?

I use it for all things camera wise and it it works like a charm.

:bust_in_silhouette: Reply From: Peter

Hi,
I have just used a second animation player in the tree to solve this (2D) :slight_smile:
Greets