Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Using animations from variables in Anim BP?

I would like to have a set of animations (montages and blendspaces) that would control my character. Instead of hardcoding animations in animBP, I'm hoping to use animations from variables. However I have not had luck yet. I would love to use animBP as it contains very powerful tools for blending animations.

Lower body animations (idle/walk/run and crouching) stored in 2 properties of the character

 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Animation)
 UBlendSpaceBase* MoveNormalAnim;
 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Animation)
 UBlendSpaceBase* MoveCrouchAnim;

Other animations would be set for upper body into each item available in game.

 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Animation)
 UAnimMontage* EquipAnim;
 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Animation)
 UAnimMontage* IdleAnim;
 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Animation)
 UAnimMontage* UseAnim;

For example when I try to pull the lower body blendspace into animBP it doesn't seem to understand it at all. See the screenshot. alt text

So what to do..? Should I just give up and accept my fate that I can't have animations dynamically from variables/properties?

Product Version: Not Selected
untitled.png (118.8 kB)
more ▼

asked Feb 08 '15 at 01:47 PM in Blueprint Scripting

avatar image

21 7 8 10

avatar image Ukkoprkl Feb 19 '15 at 08:49 PM

So no-one has tried on dynamically setting the used animation in anim BP? Or is it just plain impossible?

Does anyone know what type of object the editor uses when it shows dragged blendspace in the anim BP? I have started on looking to editor source, but it's most likely too long road to follow... At runtime it should make no difference what animation sequences it evaluates as long as they match to same skeleton?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Found a solution to this. You can grab a blendspace into anim graph and the from its properties you can show the blendspace as a input which you can pin the input you want. Cheers!

more ▼

answered Mar 15 '15 at 08:21 PM

avatar image

21 7 8 10

avatar image nkey Nov 30 '15 at 08:43 AM

Could you please provide more details? Can't do it myself.

avatar image ExTheSea Dec 20 '15 at 09:37 PM

While this is quite an old question I just stumbled over this myself and this was the solution. So in your locomotion graph of one of your states just drag any Animation sequenze you already have in it and link it up to the Result "block". Then click on the Sequenze block you dragged in and look at the settings ( bottom right of the window). Here you can then check the checkbox of the first first property called "(As Pin) Sequenze" to make it show up as a pin in the graph. Now just hook up your animation Sequenze variable to it.

avatar image antifreak2011 Jul 16 '17 at 08:44 PM

Yeah nice, it worked perfekt! Thx for this solution

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
  1. Drag and Drop a some animation into anim graph

  2. Expose the animation sequence pin (Look to the right side window, details panel?)

  3. Now you can attach any animation you want to it.

  4. After exposing the animation, I have attached Current Idle anim (Whatever it maybe at run time) to the Play Animation sequence node.

alt text

more ▼

answered Mar 03 '18 at 01:01 AM

avatar image

218 6 9 12

avatar image MarCraft23 May 21 '18 at 11:27 PM

When would one set the "current idle anim" var though? in a setup where you have potentially endless weapons and you can switch between them at runtime (and the individual animations are associated with the weapon obj), i found that you have to set the vars inside the anim blueprint on tick or on begin play. i cant set it once inside my controller or even pawn once i switch the weapon. Is there a more elegant solution to this problem?


avatar image shrikky May 21 '18 at 11:53 PM

Many ways do it.

Create a Data table called Weapon DB. This will have all the details regarding the weapon, such as bullet speed, bullet damage, Idle animation etc.

Create a function called SetCurrentIdleAnim in your animation blueprint.

When you call your switch weapon function, grab the animation associated along with the weapon (From the data table) and pass it to SetCurrentIdleAnim.

By doing this, you send the current idle animation everytime you switch the weapon instead of polling it in a tick function.

Hope this helps.

avatar image MarCraft23 May 22 '18 at 01:53 AM

oh yes the event based approach works as well. My problem was the multiplayer part. If anyone has the same issue: The server can't change the client's animation! its always a netcode problem, makes life so much worse :D thx

avatar image dragonsomnolent Feb 09 '19 at 07:27 PM

Holy smokes, this is EXACTLY what I was looking for and so I'm adding this comment to increase it's visibility in any way I can. Thanks, you're epic, don't ever let anyone tell you otherwise

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Actually I think it's possible. According to your screenshot, I think you should cast your character blueprint in the event graph instead of the anim graph.

For my game, I use the EventGraph from the animBP to get all the variables and let the AnimGraph uses it. For example, I use the EventGraph to get 2 variables (forward and side), and then use those 2 variables in the AnimGraph.

alt text alt text I don't think I can explain it as well as the video, so I really recommend watching it.


eventgraph.jpg (230.8 kB)
animgraph.jpg (210.7 kB)
more ▼

answered Feb 19 '15 at 11:31 PM

avatar image

121 4 2 8

avatar image Ukkoprkl Feb 21 '15 at 06:23 PM

Hi and thanks from your example. For me it looks like that you have pulled only variables containing input values for a blendspace. I'm actually trying to get the blendspace (or other animations) itself from a variable.

I was looking more into the editor and I will try to create my own editor node(s) with the instructions given here https://wiki.unrealengine.com/Animation_Nodes,_Code_for_How_to_Create_Your_Own . A node that would extend the existing blendspace, animation montage and so on, but they would read the animation dynamically at runtime (and have a predefined one for editor).

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question