I need to create an animation from an array, but it just isn't created in Godot, I don't see it in remote explorer.
This list is reduced by 10 times from the original, this is just an example. I had to convert the animation from another program to this form because it is impossible to export animation in it
Help me, I don't understand what the error is:
extends Node3D
@onready var animplayer:AnimationPlayer=$fire
var animation_table=[{'rotation':Vector3(0,0,-1),'time':0.60,'position':Vector3(0,0,0),'name':'Hammer'},
{'rotation':Vector3(0,0,-1),'time':0.60,'position':Vector3(0,0,0),'name':'Handle'},
{'rotation':Vector3(0,0,-1),'time':0.63,'position':Vector3(0,0,0),'name':'Joint'},
{'rotation':Vector3(0,0,-1),'time':0.9,'position':Vector3(0,0,0),'name':'Barrel'}]
func _ready():
var animname='base'
var base_library=animplayer.get_animation_library('das')
var new_animation=Animation.new()
var added=base_library.add_animation(animname,new_animation)
var animation=base_library.get_animation(animname)
for table in animation_table:
for type in ['position','rotation']:
var track_path=table.name+':'+type
var track_name=track_path+'_track'
var a:String
var anim_type='TYPE_'+type.to_upper()+'_3D'
var track
var has=animation.find_track(track_path,Animation[anim_type])
print(has)
if has:
track=has
else:
track=animation.add_track(Animation[anim_type])
animation.track_set_path(track,track_path)
animation.track_insert_key(track,float(table.time),table[type])
animplayer.play(animname)