x

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. 

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.

Product Version: UE 4.12
Tags:
more ▼

asked Jul 28 '16 at 03:12 PM in Blueprint Scripting

avatar image

Dark_Jubei
172 33 46 52

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

1 answer: sort voted first

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: https://www.youtube.com/watch?v=EM_HYqQdToE

All the best.

more ▼

answered Jul 30 '16 at 11:42 AM

avatar image

Diego_Visualma
596 13 10 34

avatar image Dark_Jubei Aug 01 '16 at 03:43 PM

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

(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