Play Matinee from and Actor BP?

Hello,

Ill try to be brief. I have set up this: When VR headset looks at a BP actor, it highlights, then when highlighted, the player can press a button (A, X, Z whatever) and it will play a matinee animation. It was from a tutorial, but my understanding is that the character calls specific function events when/if they are looking at the object. However, from inside the actor/objects event graph i cant seem to reference a matinee actor, i seem to only be able to do that in the level BP.

I really just need it to play the matinee animation then reverse with a flipflop whenever the character is looking at the object and presses whatever button. I’m still learning blueprints, so this is causing a giant headache. Any help would be appreciated, i hope my problem makes sense.

Hello, Dark_Jubei,

Your problem is that only the level blueprint knows your matinee actor (or sequencer, for that matter) is in the level; it is actually containing every actor spawned within. But the other actors can’t know what is in the level, or what components are inside other actors, unless you get an explicit reference to them. That is the reason you can reference the matinee the same way that you can get a reference to any component within a given blueprint (by just dragging). Notice that if you try to drag a different spawned actor to some random blueprint you wouldn’t be able to reference it either (but would in the level blueprint).

To call an event, function or variable inside another blueprint you need a reference to the particular actor before you can begin communication. There are many ways to get it, for example a trace, like the tutorial you mention is probably doing, or an overlap. Also many ways to establish communications, either directly, by using an interface (also probably in the tutorial) or an event dispatcher.

The thing is that you can’t trace/overlap/etc with your matinee actor, so getting a reference to it is harder. Also, no actor can get a reference to the level blueprint because the level BP isn’t an actor, so communicating with it is hard too.

You have three possible solutions:

1.- Create an event dispatcher in your level blueprint, so it is listening to your highlighted actor. In this case, the actor can’t get a reference to the level BP, but the level BP can get one to the actor (it is spawned), and it would be continuously listening to a particular event on your actor so when that fires a custom even on your level fires too. That would in turn play the matinee.

2.- Play it from your game mode. Any blueprint can, at any time, access the current game mode by using the “get game mode” node and casting to its class, so it is extremely useful. To do so, create a new game mode blueprint and select it in the project settings (or open the game mode blueprint that you are using if it isn’t the default class). Then make a variable in the game mode of the type “matinee actor reference”. Now, on your level blueprint, on begin play, get the game mode, cast to it, and set your matinee reference variable with the matinee actor that you can access in your level blueprint. Now, on the game mode, make a new custom event that will get its matinee variable and play it. Lastly, on the blueprint that you want to cause the matinee to play, also get the game mode, cast to it, and fire your custom event.

3.- Play it from your actor directly. If you can get a reference to your actor in your level blueprint (ie the actor exist on the editor, it will not be spawned after you hit play), then this is similar to the method above. Create a matinee reference variable in your actor. Drag your actor to your level blueprint so you get a reference to it. Cast to its class. Then on begin play set its matinee variable with the level’s matinee reference. Now you can access your matinee from inside your actor, like if you were on the level blueprint, and you can play it whenever you want.

Blueprint communications is a broad but important subject. This video might help. It covers casting, interfaces and event dispatchers, in case you aren’t familiar with the concepts: Blueprint Communications | Live Training | Unreal Engine - YouTube

All the best.

Very helpful information Diego_Visualma, thanks very much for your response. I will try to work though the items you discussed soon.