Level Blueprint or Player Blueprint to trigger matinee only when looking at the Object?

OK so I have a billion questions and I realised it would be a bit cumbersome to ask them all at once. So I’ve decided to divide them up in the hope of getting quick answers and moving on.

I’m currently making a First Person game (much in the vain and Gone Home or Cradle). I want to be able to trigger a matinee animation (in this case a the opening and closing of a drawer) when clicking LMB. This matinee should also only trigger when I look at it.

My main question for now is, would I do something like this in the Level Blueprint or the Player Blueprint?

It’d probably be best to keep the communication between the player BP and the object’s BP. For example, you could set up a raycast so that every tick it checks 2 feet away from the player camera if there’s an object. If that object is a ‘Matinee friendly’ object, report back and then you can do something with it.

Then you can build however many levels you want, and you’ll always have this functionality available on the player and any tagged objects.

Ah brilliant suggestion, this seems to be what I’m looking for! Thanks a million!

Going to try and figure this method out and see how it goes.

I’ll post here again if I have questions regarding this situation. Hopefully, you can help me out again?

Once again, thanks for helping out! Now I at least now which direction to work in.

Ok so will the raycast be Line Trace by Channel or Object?

And when you say “Object’s BP” do you mean I have to add a blueprint to the object? At the moment it’s a make shift drawer out of cubes.

Here’s a screen:

Cool, glad it helped. Here’s some really old BP I have that did the line trace.

It basically draws the line, and then breaks whatever is ‘hit’, then checks to see if it has the tag I’m looking for. In this case “tagSetOnObj”. Tags are pretty nifty. You’d probably set them on all the objects you want to test against (like the pictured chair). This scripting pictured also uses a debug line. (I’m no pro in this department so there’s probably a better way!)

So this scripting would be in your player BP. Then in all of your assets you want to tests against (e.g. is it a “chair”), go into that asset’s BP and set a Tag. Then when you test using the raytrace, you can see if it has that Tag and then…do something with it :slight_smile:

More on tags and finding out asset types: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/FindingActors/Blueprints/index.html

If this answers the question feel free to mark as answered to close it out.

Sorry for dragging this out man, but I think I’m so close to getting this right.

Problems I’m having:

  1. As the blueprint is now, I don’t see a Line Trace fire?

  2. I can only have one “Event Tick” in Player BP and I’m already using one to pick up objects with RMB. Is there a way around this? Can I for instance replace it with “InputAction Action” (LMB) like in my screenshot?

  3. Can I use the tag “animate” to reference all actors/assets that I’m going to animate. Or is this method focussed on one specific actor. (So then rather use the tag “Drawer Animate”.)?

  4. can’t reference a Matinee Actor in my Player blueprint and in this case I want the line trace to read the tag, and if is rings true, then play the matinee animation. Is this possible?

Screenshot of current blueprint:

Thanks for all your help man, really appreciate it! If I can get past this step I can start focusing on getting more creative, as now I don’t see the point in going on until I figure out the game mechanics.

Ok I figured out how to reference the matinee in the Player Blueprint. You create a Matinee Actor Variable in the player BP and tick the editable box in the details panel. Then after compiling and saving your Player Blueprint, you go to the editor view. Then with your Player character selected, you go to the default section of the details panel and search for whatever you named the Matinee Actor variable. Next to it is a drop down menu where you can reference the chosen Matinee animation

Cool, here’s a few replies:

1) As the blueprint is now, I don’t see a Line Trace fire?

Not sure what you mean on this, can you expand?

2) I can only have one “Event Tick” in Player BP and I’m already using one to pick up objects with RMB. Is there a way around this? Can I for instance replace it with “InputAction Action” (LMB) like in my screenshot?

Yes, totally doable to use the left click to fire off the trace. Or you could copy and paste the tick node, but I’ve only used that sparingly.

3) Can I use the tag “animate” to reference all actors/assets that I’m going to animate. Or is this method focussed on one specific actor. (So then rather use the tag “Drawer Animate”.)?

It’s really up to you and how you want to classify your objects with tags. If you create a broad system that reads in a few tags, the objects will have to be setup with those specific tags. More broad, reused tags means the system will probably be more flexible and easy to manage.

4) can’t reference a Matinee Actor in my Player blueprint and in this case I want the line trace to read the tag, and if is rings true, then play the matinee animation. Is this possible?

Looks like you’ve answered this one so I’ll leave you to it :slight_smile: Nice!

Any more questions, let me know! Otherwise feel free to close out.

hey can you post a video about that or explain more
cuz im trying to do what you did and failed so many times