Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

How do you translate position value at one scale to a position at another scale? (Hololens UI)

edited July 2017 in General

What I'm trying to do is to create a canvas element with its height and width determined by two gameobjects that represent the top-left and bottom-right respectively. The gameobjects are placed where the cursor is located when I air tap. Now the Vector3 position that I get for the two gameobjects are very close to each other numerically. So when I take the difference between the x-coordinate values, or the y-coordinate values, etc., that difference value is very small. Then when I instantiate the canvas based on the dimensions calculated, the resulting canvas's width and height become really small under the RectTransform property. (note: scale is at (1, 1, 1)) It's too small to place any UI on it. This can be remedied if the scale value in RectTransform is really small (instead of (1, 1, 1)). I came across this from examples provided in the HolotoolKit. The canvas element in these examples have really small scale values. For example, the ColorPickerExample has (0.05520535, 0.05520535, 0.05520535) for the canvas scale. With this scale value, the canvas size can be 100 by 100.

So my question is, I can I place a canvas at any scale given the desired boundary points?

Thanks in advance!

Tagged:

Answers

  • If you know the scale ahead of time you just apply the scale to the transformRect and then multiply the scale by the dimensions you found and apply that to your boundary.

    Taqtile

Sign In or Register to comment.