Download

VR Gaze Interaction, No Controller

I’m using Line Trace to point to hotspots in my level and the character automatically moves to that location. I’ve got it set up where I can click on a marker and move there, or using Event Tick, if I look at the hotspot, the character moves there. I want to set it so the character has to look at the spot for 2 seconds, then the character will move. If the character looks away under 2 seconds, the movement is canceled. I’m stuck and can’t figure out how to make this happen. Once the character’s Line Trace hits the spot, it automatically moves there, even if you just glance over the spot.

Hey DMHokie,

Are you using Blueprints or C++?

Blueprints

This is how I would begin:

LookAtActor is a Blueprint Actor class that would be used for what to look at. It would also need collision settings for the trace to hit it, which I think it would by default.

Essentially, you would keep track of the trace hitting or not hitting the LookAtActor. If the trace has been hitting the LookAtActor for 2 seconds (calculated with DeltaTime), you could then teleport the player. If the trace fails during that 2 seconds, you could then reset the LookAtActor reference and LookingTime.

You might also want to do something so the look at actor can only be used once, or from a specific range, but that is up to you.

That is perfect! That does exactly what I needed. Thanks for the help.