Daggerfall Unity VR with the Vive Pro

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

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Is Debug.Log() attached to the camera or the PlayerAdvanced object though? What I'm getting at is the two are probably separating until you teleport. The transform.position will only read the position from the GameObject it's directly attached to.

You'll probably need to drag PlayerAdvanced around with the camera as well, so player can do things like sidestep incoming missiles and the like. It sounds like you have everything under control though, I'll just let you do your awesome thing. :)

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

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

I've attached it to a number of things, in an attempt to get it to output sane values. Most recently I've attached it as a script to the camera itself, to get the offsets from its parent GO (the PlayerAdvanced). Currently their positions do diverge, but if I'm going to make them continually converge (as a child or continually moving the PlayerAdvanced into position) I need to be able to read the camera's values accurately. I think it might be caused by missing a SteamVR_Tracked Object script on the camera, possibly.

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

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Yeah, definitely sounds like something unusual is happening there. The transform.position should always be object's live position in the scene graph at that frame. I have no idea what might be interfering with this, I'm sorry.

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

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

No worries. I think just by explaining it it helped me track it down. I added the Steam VR_Tracked Object script, and even with it disabled it seems to have kicked something into gear. Now the values are being reported accurately! This lets me keep the Player's position correct, and now I can look down to see the UI. Hooray!

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

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Right on! I'll look at adding those input coordinates for you very soon. Looking forward to seeing another video of the UI in action when you're ready. :)

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

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Interkarma wrote: Thu May 31, 2018 11:22 pm Right on! I'll look at adding those input coordinates for you very soon. Looking forward to seeing another video of the UI in action when you're ready. :)
I'm getting pretty close to having something cool to demo, but I have a UI question you can probably clear up quickly: if I wanted to make a new custom UI component that I could display as I do the RawImage I grab from the NonDiegeticUIOutput, how would I do it? For example, let's say I want to create a Quad with a RawImage that'll receive a texture that draws a HUDCompass. What sort of things do I need to create and set?

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

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

No need to grab the RawImage from NonDiegeticUIOutput. Just disable NonDiegeticUIOutput completely and get the RenderTexture directly from DaggerfallUI.Instance.RenderTarget.TargetTexture. That's the source of the main UI output texture.

Right now there's only a single UI stack that all gets rendered to the same render texture, but it's definitely possible to extend this to add custom output.

Are you able to bear with me for bit until I can take a look at this? I should be able to put something in fairly quickly when I have time. It might not be for another 24 hours or so though.

The gist of it is the following:
  • Allow RenderTarget component to use custom dimensions. This way you can attach RenderTarget to its own object anywhere (like a quad down near the player's waist for example).
  • Add a new Panel root to RenderTarget. This will allow you to just stick your own BaseScreenComponent objects in there to render in their own stack. This would be perfect for single controls.
  • Inside Update() on RenderTarget, update Panel root.
  • Inside OnGUI() on RenderTarget, draw custom root.
That should work, although I'm probably missing something. Up to my eyeballs in work at the moment. :)

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

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

It's just about midnight, but even if it wasn't, no worries if you want to take some time! I'm working through some bugs in handling the controllers. It should hold me over until I try adding custom UI components. Thanks

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

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

No problems, thank you. :)

Alternatively, you could just use the regular Unity GUI for custom components like this. My UI system was only really designed to emulate the classic UI stack and might not be the best for your custom work. If you use uGUI you pretty much have full control over what happens on the custom elements.

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

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

I've made a start on this now. Will do some more later today and hopefully have a working example for you. The code I posted to git last night is only about half the things I need to do.

Post Reply