Daggerfall Unity VR with the Vive Pro

Discuss coding questions, pull requests, and implementation details.
User avatar
Interkarma
Posts: 3495
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma » Thu Jun 07, 2018 9:14 pm

Thank you Mike. :) I'm trying, but not always succeeding lately. Hopefully things will settle down a soon and I can get back to magic & effects development.

User avatar
InconsolableCellist
Posts: 91
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist » Fri Jun 08, 2018 12:05 am

Interkarma wrote:
Thu Jun 07, 2018 9:14 pm
Thank you Mike. :) I'm trying, but not always succeeding lately.
Could've fooled me! I should reiterate that you're doing a great job, and I'm appreciative that you are willing to change things up for feature requests like this. I think it helps too that at the end of the day everyone agrees that we just want to recreate and even improve Daggerfall.

User avatar
InconsolableCellist
Posts: 91
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist » Fri Jun 08, 2018 5:12 pm

I can't tell if it's my environment or not, but I was having a few issues with having the UI respond to mouse and keyboard input after I had hit the escape key once or twice. When in Privateer's Hold, if I hit escape (to get my mouse free to adjust things in Unity) and then hit escape again to dismiss the menu, I'd find I couldn't subsequently hit escape or things like F6.

Another tricky aspect is that using "free aspect" in the game view seems to interfere with the the mouse position in my case. I have to set it to "remote," which is the resolution of my HMD, or maybe just the left eye (2299x2554).

Can you think of a reason why the mouse position wouldn't correspond to what's expected when I do free aspect in Unity? Perhaps there's a way I can have a visual indication of where it think the mouse is vs. where the overlay blue Daggerfall cursor is on the Game view. This is pretty much for testing purposes, as I'll need to use both mouse and laser input when developing the latter.

User avatar
Interkarma
Posts: 3495
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma » Fri Jun 08, 2018 7:33 pm

I'm not sure sorry. The example I put together was just to show the concepts. As long as you can track pointer position as U,V styled coordinates in 0-1 domain across canvas and know the underlying RenderTexture width and height, the input calculation should be pixel perfect no matter the aspect.

I'd say work on input implementation without worrying about DFU at first. Just try and get a reliable U,V position on your canvas object. This is all happening at Unity level anyway, you're just feeding the resultant coordinates back in to my UI panels.

User avatar
InconsolableCellist
Posts: 91
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist » Wed Jun 13, 2018 2:41 am

My problems stem from UserInterfaceManager.cs:207. If enableHUD is disabled, it won't unpause the game (but it'll still remove the menu). However, as part of the test script I was disabling the HUD.

Do you recall the implications for wanting to check if the windows.Count is < 1 instead of <= 1, like line 202 has it? Is it because when the HUD is disabled it shows up with the classic big bottom bar, and that doesn't count as a window as far as the pausing logic is concerned?

User avatar
Interkarma
Posts: 3495
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma » Wed Jun 13, 2018 3:59 am

This is not something I experienced in my example code above. I am also disabling HUD there.

Edit: Make sure the HUD is still being added normally and you're disabling from script later (as in my example). Disabling HUD from Inspector (by unchecking "Enable HUD") will prevent it from being added at all and might have undefined results in UI stack in this case. Please let me know how and where the HUD is being disabled.

User avatar
InconsolableCellist
Posts: 91
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist » Thu Jun 14, 2018 2:16 am

Interkarma wrote:
Wed Jun 13, 2018 3:59 am
This is not something I experienced in my example code above. I am also disabling HUD there.

Edit: Make sure the HUD is still being added normally and you're disabling from script later (as in my example). Disabling HUD from Inspector (by unchecking "Enable HUD") will prevent it from being added at all and might have undefined results in UI stack in this case. Please let me know how and where the HUD is being disabled.
I'm only disabling the HUD in that one script, but for the moment I'm still working around it by having changed that line of code to permit unpausing when the windows count is greater than or equal to 1.

In the meantime, I have some preliminary UI interaction working!

https://www.youtube.com/watch?v=scr-TUecARc&t=5s

The laser pointer is a bit janky and I'm using a temporary button scheme, but it works. I'm a bit concerned, however, as I wasn't able to emulate Mouse 0 events. Instead, I had to change line 568 of BaseScreenComponent to look for a new Input.GetButtonDown event I set, "VRTrigger." I'll have to make it more complicated too as I end up supporting the controllers' "hair trigger" axes.

User avatar
Interkarma
Posts: 3495
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma » Thu Jun 14, 2018 10:24 pm

That looks like a good result so far! :)

I mentioned earlier I'll still need to find a way for you to inject clicks back into the UI. This will let you handle this in any way you need and just fire the signals required. I imagine we could make this work a bit like the mouse coordinates.

I'm trying to re-focus on gameplay features for now on the lead up to exiting pre-alpha, but should be able to help with this in a limited way in the near future. Are you able to keep working around it for now?

User avatar
InconsolableCellist
Posts: 91
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist » Fri Jun 15, 2018 12:20 am

Interkarma wrote:
Thu Jun 14, 2018 10:24 pm
That looks like a good result so far! :)

I mentioned earlier I'll still need to find a way for you to inject clicks back into the UI. This will let you handle this in any way you need and just fire the signals required. I imagine we could make this work a bit like the mouse coordinates.

I'm trying to re-focus on gameplay features for now on the lead up to exiting pre-alpha, but should be able to help with this in a limited way in the near future. Are you able to keep working around it for now?

Thanks! And I forgot you mentioned that. However I'm fine working around it for now, and I support focusing on gameplay and pre-alpha issues for sure. I can refactor my workarounds when the time comes.

User avatar
InconsolableCellist
Posts: 91
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist » Fri Jun 22, 2018 4:49 pm

Things are going well, I'm making gradual improvements to all aspects of the VR experience. Or at least, one step forward, sometimes two steps back as problems are revealed.

One question I have that impacts the core code: I need the ability to somehow generate the ActivateCenterObject Action, so that the thing the user's looking at can be interacted with. I'm doing this currently by making the list of current actions in the InputManager Public, and then I manually .Add() onto that list with an ActivateCenterObject.

Is there a better solution that you wouldn't mind putting upstream? If you like this solution, it's just private to public on one List<>, but I wouldn't want it to encourage unexpected behavior from other mods if it looks like that method is being encouraged.

Additionally, I notice that the PlayerActivate shoots a ray out from the MainCamera and does a bunch of logic to see if the targeted object can be interacted with. I've changed the MainCamera to be my VR camera, but I'm experimenting to see if I can set it to the VR controller that made the interaction request, so that you don't have to be looking right at the object you want to use. If this works I don't think any big code changes would be necessary, but I did also have to make that mainCamera GO a public in PlayerActivate.cs:35

Post Reply