Download

NPC-Problem Understanding Character and Animation Blueprint Interaction

Hi there,

also after looking for answers/solution since yesterday I just don’t get it :confused:
I think I am close to the solution (maybe with two different approaches).

**What’s it all about: **
I am working on a (VR) music experience, partly interactive, partly scripted.

For this I have an NPC in my level, which is a human with wings in a socket on his back within the Character Blueprint.
The NPC shall appear in different moments in the level in different poses.

Now I have

  • set up an Animation Blueprint used by the instance of the Character Blueprint placed in the level.
  • I have added variables in the Animation Blueprint to trigger the state inside the State Machine which works from within the Animation Blueprint when I set them as default.

For example: I added a boolean variable called “Sit Down” and as soon as I set it as default value within the Animation BP the NPC sits down as soon as the level start.

Before that I had tried to add variables within the Character BP for the same purpose.
But how I could use them to trigger the poses in the State Machine?
I can’t find any way to do that.
May I misunderstood the principles of the structure?
Do I maybe have to create an additional Pawn to be able to control the NPC from another BP?

In the end result I’d like to be able

  • to place this and other NPCs into the level in the editor (re-using the animation BP for different meshes) and
  • spawn others based on events in the “gameplay”
  • set the default pose within the editor for instance I am placing manually
  • set the default pose of the dynamically (by event) spawned characters

Thanks to anybody who can help to clear the fog inside my head :smiley:

Cheers!

can you show us the animation BP? Sounds like you haven’t made a cast to the character BP in order to get access to the variables within it, and then use the values of those to drive the values of the variables within the animation BP. Follow this example might help.
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/CharacterMovement/Blueprints/index.html

Hi Lioki,
you are right for sure :wink:
Here is my current BP - nothing besides some trials to rotate the legs for more control in specific poses in specific places within the level.
00450eb78c985f254b6df1b51589f996d9b1f521.jpeg

My problem is that I can’t figure out how to do what you say.
All examples show a pawn but I only have the character BP because I thought that I don’t need one for an NPC as the movement does not rely on key-controls etc.

Here is a screenshot of my Character BP - I don’t remember exactly why but I have no capsule component in there but most tutorials have one O_O
feeb8df8af72d3fc0ab485f8813bed0a6b004c34.jpeg

You need to drive the variables in your Animation BP somehow. You would, for example, have another Pawn BP that holds the logic for the NPC character, you would cast to that BP inside the animation BP. It works much the same way as the tutorial I linked to you.
Please keep in mind I don’t have the greatest knowledge on these things but I am trying to learn. So we could end up in a cycle of the blind leading the blind lol!

Well, two are better than one, blind or not :wink:
Thank you so far, It’s time to experiment a bit!

I finally got it.
I had messed up the Character BP originally by deleting the capsule etc. (don’t ask me why :smiley: ).

I build it up from scratch again and was able to grab the variable lying in the Character BP from within the Animation BP.
So I could trigger the states within the State Machine and start the level with a default sitting pose. Now it#s just about adding IK for the feet to prevent them from landing inside the stairs :slight_smile:

Thanks Lioki, you helped me to get on the right track!

Character BP:
d217b2636d9f5da291a95a08b5832a71daeb20d6.jpeg

Animation BP:
9edaa02f1c913f14117862b247061fde8d63fbfd.jpeg

**Controlling from editor: **
5e1b16ee2ec82bbe4faa2c0f41d782e37fe59144.jpeg