I want to make a trigger where the player camera triggers a Matinee but can only be triggered if the player looks in that direction. Like if the player passes a trigger box it makes a sound effect that make him look behind and if he looks, it triggers a matinee. But it only works if he’s looking that direction. Im sure with a single ling trace it would work but how? Please help x_x been searching for a while.
I remember reading something about a function or something where you can check if something is on screen.
But it would probably work better if you could use the cameras view frustum for collision detection.
I was able to achieve something similar with line tracing. Basically, for your setup, you should have a seperate trace channel dedicated to this (can do this by adding one in project settings>collision) and use trace collision (overlap) on the object with the new trace channel. Now for you to start a matinee, you would have to either in your level blueprint or player charecter blueprint use event tick node and connect it to check if the line trace is overlapping your object and if yes, then it should trigger the matinee. Or you can setup a trigget box within which this setup gets input into level blueprint though an “oneventbegineoverlap” so that your game is not ticking the whole time (consideration for performance).
when player passes trigger box set a booleanCheckForMatineeTrigger to true
if booleanCheckForMatineeTrigger is true then
- spheretrace from camera world location to 1000 cm in front of camera (use getWorldLocation, getForwardVector, sphereTrace)
- enable a collision box behind the player, so when player turns around, the sphere trace that is constantly firing in the event tick will hit the box
- when spherecast hits object collision box then trigger matinee
There are probably some more efficient ways to do this, I’d be curious if there are shortcuts.
Can u put pic of it? or a video? plz
Here is the my exploration charecter (player charecter) blueprint corresponding to the trace.
The execte console comand node has “CE F2B” where ce is console execute and F2B is my fade to black matinee. I think this setup will be helpful for you.
Things to note:
Notice the trace channel in LineTraceChannel node. I says Teleport. This is a custom trace channel I created in project setings>Collision>Trace. I ahve attache a picture for the same.
Another thing to note, is that I created this Blueprint for use with an HMD like the oculus rift. So the this part of the BP is only triggered by the buttons I have assigned. You will have to connect the starting node to event tick and then have to filter through a condition whether the trace gets a hit or not, and if i does, then to execute the console command to start the matinee.
I hope this helps!
Best of luck!
I have the Line trace working fine and can destroy an BP_object (mesh) by looking at it in the Rift. But activating an Matinee by looking at an specific BP mesh, i just can’t get it to work.
Where is the refference to the matinee in the above BP tutorials? Should i connect the Mesh_BP somehow to the Linetrace in the Mesh_BP blueprint itself, seems you cannot tell the Mesh_BP to play a Matinee?
The only thing i need to work:
Play a specific Matinee when looking or gazing at an created Mesh BP.
Use an AiPerception module so you player blueprint will get a callback when it “sees” the trigger. It’s way better than repeatedly firing line traces and despite its name, it can be used by non-AI. Check this thread to see how to use it: https://forums.unrealengine.com/showthread.php?66810-Quick-AI-Perception-Jumpstart.