how to change AnimationNodeAnimation by script ?

epicspacesepicspaces Posts: 75Member
edited July 20 in General Chat

when generally, we click on a node in a statemachine :

can someone change this ?

animation clips at runtime ?

Comments

  • epicspacesepicspaces Posts: 75Member
    edited July 20

    by script of course ? (assigning the new animation to the node)
    since I have a little bit complicated architecture; I didn't want to duplicated over and over, but just reassign animations, like it is widely used in Unity.

  • TwistedTwiglegTwistedTwigleg Posts: 4,621Admin

    Maybe by getting the tree_root (doc), navigating to the node using get_child_by_name (doc), and then modifying the animation using set_parameter (doc)?
    Just looking through the API though, it looks like it's fairly complicated to modify, which is a bit surprising. Using tree_root and navigating to the node that way seems to be the only way to get the AnimationNode though.

  • epicspacesepicspaces Posts: 75Member

    AnimationNodeStateMachinePlayback ansmp= at2.Get("parameters/playback")as AnimationNodeStateMachinePlayback;
    AnimationNodeStateMachine ansm= at2.TreeRoot as AnimationNodeStateMachine;

    AnimationNodeAnimation anim_node = new AnimationNodeAnimation();
    anim_node2.Animation = "UnUseItem";
    ansm.ReplaceNode("UseItem",anim_node);

  • epicspacesepicspaces Posts: 75Member

    it works thanks me

Sign In or Register to comment.