Forum

You need to log in to create posts and topics.

Hololens setup

Hi,

Im trying to get powerui to work on the Hololens. It does render, but in world space instead of screen space.

Are there specific settings or game object layouts that need to be used to work correctly on the Hololens?

Currently my main camera is a child of my Player GameObject, would this be a problem (I have followed the wiki and masked the PowerUI on the camera).

Any help would be appreciated.

Cheers,

David.

Hey David,

In all cases for AR/VR you'd want to be using a WorldUI - they use the same documents and techniques as your main UI but are positioned in world space. If you'd like your UI to be visually in the same place - so as you move your head it stays where it is - then you'd need to parent that WorldUI to your Hololens camera. If you'd like it to stay relative to some reference object, then typically the WorldUI is parented to that object instead (or included in its prefab). WorldUI's can be placed in prefabs and instanced on demand using any of your preferred techniques too.

These WorldUI's also have an option called "always face the camera" which you'd likely want to be using if it's parented to an object in the gameworld - that way it will rotate to face your main camera (or a configurable camera) as the main camera moves through the scene.

You'll probably also want to handle points and clicks too - check out the guide on virtual reality cameras for how to handle input (and use that to hook up your air tap etc).

Hopefully that helps! 🙂

Hi Luke, Thanks for the link. I'll give that a whirl.

 

Hi again. That seems to be working well. The input needs work now, but its ok.

I noticed there was an "Input Enabled" flag in the WorldUIHelper - does this allow the hololens cursor to interact with the buttons etc?

Thanks again for helping. Was stuck for a while 🙂

Hi Luke,

Im really not certain how PowerUI should interact with the Input system.

I have built an Input Mouse as suggested here: https://powerui.kulestar.com/wiki/index.php?title=Input_Pointers#Making_it_click

But there doesnt seem to be any interactivity with the PowerUI page and the cursor. Im using things like CSS hover and and such, I would think that should just 'work' ?   Before using WorldUI this interaction did work - could it be a scaling issue?

Again, really like the toolkit, and thanks for the assistance so far, youve been a great help.

Sorry to continue asking questions here. I have a couple more questions about PowerUI - especially the WorldUI setup.

Q1 - It seems I can have multiple panels, however Id really like the UI to map to a 3D surface I have (its being very tricky trying to scale and line up a surface that I want some PowerUI to appear over) - is there a way to render the UI to a surface or a Face of a Cube or similar?

Q2 - Is there any info on how the scaling works for the WorldUI? It seems changing the Pixel Width, Scale, and Position all effect the size of the rendered UI (which seems odd especially for position). Are there settings I shouldnt be using?

To explain this: Ive been trying to size and position the UI against a "virtual table" angled from the table edge downwards. If I move the UI, the sizing seems to change, then if I correct the size using scale or pixel width, then I need to move it again and the cycle continues 🙂

Any help would be greatly appreciated.

 

Q2 - I think I found the problem. "Pixel perfect" is what seems to be doing it. If I turn this off, the movement and scaling is fixed.

<edit> - erm sort of. Theres something happening I dont really understand to the Plane mesh when scale is used. Need to dig through the code I guess.

<edit2>

The problem in WorldUI is that the localScale is used to calculate the new localScale in OnEnable.

So everytime the WorldUI is enabled the localScale will change because it will recalculate itself - is this intended? Wouldnt it be better to simply use the localScale to modify the mesh, and have properties for modifying how the UI is displayed? This is what Im adding to it now which has solved my problems with getting the UI to correctly place and scale.

Is there a better way to do this?

<edit3>

The child object has localScale set - should all axis be scaled like this?:

                float scaleFactor=(10.0f * scale.x) / (float)PixelWidth;
                WorldUI.transform.localScale=new Vector3(scaleFactor,scaleFactor,scaleFactor);

Want the latest updates? Check out the repositories.