Download

Gaze based highlighting on actors

So I’ve been pretty stumped on this specific situation for the past day or so. When the player looks at four different actors, and they must be in a certain order, they each highlight/outline indicating that they are looking at the correct actor in the correct order (Green for correct and red for incorrect). Each actor will stay highlighted green until they reach the last one where an action then takes place to move the game forward.
I’ve found countless examples, VR template, ray casting, and line tracing, and I just can’t rack my brain on how to correctly implement them into my situation. Granted, I’m relatively new to using blueprints, but this seems totally out of my realm of current understanding. If someone could lead me in the right direction I’d be extremely grateful. Thank you.

Alright, this is a relatively simple way of doing it (in my head anyway).
It functions like this:

I set it up to use only the player character and another blueprint actor that would represent a puzzle. (Although you don’t need another blueprint to hold the puzzle pieces, you just need proper references to the correct actors and it’s a bit more complicated that way.)

You have to do very little in the character blueprint with this method. You have to draw the trace from the camera forward, check what you hit and then send an event into the puzzle boxes blueprint.

The puzzle boxes blueprint has 4 static meshes, representing the actors you want to look at. An int variable for a counter, a primitive component array to hold references to the boxes you’ve already looked at and turned green and a primitive component reference variable for what the correct box to look at is at any given time. At the start of the game, you set box 1 to be the current correct target, set your counter to 0, clear your array and paint all the cubes into a neutral blue. I commented most of the flow so it should be quite self explanatory from the image.

And of course you can move the order around or add more cubes pretty easily, by adding more static meshes to the blueprint and adding more options after the “switch on int” node.
Hopefully this will get you on the right track to figuring out how to do your own system.