Hello! I was creating a bossfight for the game I am making and wanted one of the attacks to change position in realtime based on player position. The attack was created in the animation editor. Is there anyway to change the animation track and specific key values in realtime so that the attack will change based on where the player is currently? Thanks in advance!
You can change the animation during runtime, you just need to retrieve the Animation from your AnimationPlayer and then you can do all sorts of changes to it.
var animation_player: AnimationPlayer = $AnimationPlayer
var animation: Animation = animation_player.get_animation("my_animation")
var track_index = animation.add_track(Animation.TYPE_VALUE)
animation.track_set_path(track_index, "Enemy:position:x")
animation.track_insert_key(track_index, 0.0, 0)
animation.track_insert_key(track_index, 2.0, 100)
animation.length = 2.0