Download

VR Blueprunt: Look an object for 3 seconds to activate

Hi everyone,
i’m a 3D VR environment developer, i work with 3DS Max and Unreal Engine 4 with the final purpose to dispaly everything with the OCULUS RIFT.
I Attached some screenshot of my work.

A client asked me to open the door of a refrigerator and turn on a tv, without the use of a controller, i mean just trough the OCULUS aim. (for example if i watch for around 3 sec the TV i turn on the TV! Simple to think , but i’m having some trouble with this.

How can i accomplish this goal?

I saw somewhere a little clock that appear whenever i watch a sensible target for some second without the help of a cursor o a Vive, I have to reach this goal!
I’ve also searched for some tutorial without any usefull resoult… there are any appropriate terminology or name to call this function/operation in Unreal Engine 4 Blueprint?
Can you help me? Thanks a lot for your time

Hi Alessandro,
you can watch the Look based interaction Tutorials by @mitchemmc on his YouTube channel Ep. 02 (part 1 to 6):
https://www.youtube.com/watch?v=X-7Hu0HzbDU
They are very comprehensive and explain everything in details.

Another option is to use one of the many plugins available, for example @runeberg Runeberg’s VR plugin, which implements gaze based interaction.

Last but not least, you can try a quick and dirty way to do it which is roughly the following:

  • Parent to the VR camera, starting from its origin, a long thin cylinder (long enough to reach the objects you want to activate) and make it invisible. Make sure it triggers overlap events. This will be your gaze line.
  • Turn each mesh you want to interact with into an Actor Blueprint.
  • Inside the blueprint, use the On Actor Begin Overlap event to detect when the “hidden” cylinder is overlapping the object. This means the player is looking at that object.
  • When the overlap starts, you can make the object blink or get a highlighted contour to indicate it is reacting to the gaze.
  • Start a 3 seconds timer linked to an Activate custom event.
  • In the On Actor End Overlap event detect if the player is looking away before the timer has reached 3 seconds. In this case reset the object and the timer.
  • Finally, in the Activate event you can play whatever action the object has to perform when fully activated (looked at for 3 seconds).

Hope this makes sense.

Cheers,
Marco.

Thanks for the mention @vr_marco !

The fundamental concept of the Gaze Component in my plugin is this:

  1. Do a constant line trace from the Pawn’s Camera to a specified distance in the world
  2. Check hit actor for a Tag, if it exists, trigger an event where the user can specify their own action/s returning %age of time used up along with info about the hit results…

You can use BP timers and/or track GameTimeInSeconds to check for duration if you want to create your own solution in pure BP. I use a line trace + actor tag combo as it’s cheaper resource wise.

Hope that helps a bit and gives you some starting point/s to work from.

Cheers.

Thanks for reply, I already installed RunbergVR Plugin, but I was thinking was a project with some compiled blueprint that I can migrate to my project but there aren’t blueprint component.

I activate the plugin when start editor, but I don’t know how I can use :(. Sorry, I can do everything for 3D modelling, texturing and animation but I can do ANYTHING in blueprint, It is my weakness

Now I try to study tutorial recommended by Marco, but if I can take blueprint from Runerberg please tell me how I can do because I have little time for this project… thanks guys for your help

Ciao Alessandro,

What vr_marco suggested is the quickest way to achieve what you need.
In addition to that I strongly suggest you to use Branch nodes and print strings, to check ( for every single setup you create ) if the setup itself is being done accordingly.
By doing that you’re able to perfectly understand what’s going on, and quickly check if something is missing and where the problem is.
Also follow the tutorials by mitchvrlab, those were life saving when I first started with VR :slight_smile:

Hi – If you mean you want a working example, download the demo project in GitHub:

https://github.com/1runeberg/RunebergVRPlugin

There’s a map for the Gaze Component with demo code. A tutorial is also available here:

https://www.youtube.com/watch?v=tkYi…sVEm4g&index=9

There’s a basic assumption however that you understand Blueprints well enough to work on the project or understand some of the fundamental concepts.

If you are still uncomfortable with basic Blueprints, then my feeling is that you might get frustrated depending on how complex the logic for your project goes. You won’t be able to copy and paste your way thru Blueprint code for any project with a reasonable amount of custom logic. So it might well be worth the time to invest in watching a few of the Tutorials Epic provides here (it’ll save you time in the long run):

https://docs.unrealengine.com/latest…nts/index.html

For complete beginners I would suggest at least the following two to start with:

https://docs.unrealengine.com/latest…Dco/index.html
https://docs.unrealengine.com/latest…qiI/index.html

I hope that helps and good luck on your project!

Cheers,
Rune.