|
It is my understanding that by tweaking GUI.matrix the right way, I could get my GUI to show up in 3D space... is it true? Will the mouse clicks be "translated" by the matrix as well? Has anyone got an example of how to build a proper matrix? I haven't managed to do it myself, matrices are not my forte and whenever I set GUI.matrix (other than by using GUIUtility.Rotate/ScaleAroundPivot), my GUI simply doesn't show up anymore.
(comments are locked)
|
|
GUI.matrix lets you translate the 2D planes that is GUI in three dimensions. Mouse events will be translated the same. If you want real 3D objects in your GUI, an option would be to use render textures (Pro only feature) to render some 3D objects to a texture. This texture could then be displayed in your GUI and you could translate the cursor position to a 3D position in the 3D GUI scene. This last method will of-course mean a lot more work, but you will have a lot more options for applying al sorts of effects to your, now 3D, GUI elements. Hmm... no I don't want 3D objects in my GUI, what I want is for example a GUI button appearing on a 3D wall, and then to be able to click that button. I just don't know how to build the proper matrix (I tried using the localToWorldMatrix or worldToLocalMatrix of the wall transform but the GUI disappears... it probably makes no sense anyway!)
Oct 21 '09 at 09:36 AM
benblo
Ah that is a completely different question from your original wording. Might want to start a new question on that. What you are talking about is in-scene GUI, right? Something like this: http://feedback.unity3d.com/pages/15792-unity/suggestions/163344-unitygui-render-gui-to-texture?ref=title That is a feature request, but I've been toying a bit at home with hacking the GUI system into doing this. No breakthrough so far though.
Oct 21 '09 at 09:46 AM
AngryAnt ♦♦
Hmm yeah my question title and content can be interpreted in different ways I guess... I asked to "get my GUI to show up in 3D space". I hate the idea of RenderToTexture since the GUI is obviously already rendered, just shown in 2D. I just don't know how far we can go with GUI.matrix. Best thread I've found so far is this one: http://forum.unity3d.com/viewtopic.php?t=22520&highlight=gui+matrix Apparently no one's done it, what I'm trying to figure out is if it's technically possible at all.
Oct 21 '09 at 10:01 AM
benblo
That thread describes exactly what I've just told you. I even replied with the same answer to that thread. For GUI on in-game 3D objects, I still think you should create a new question and phrase it like that.
Oct 21 '09 at 11:08 AM
AngryAnt ♦♦
(comments are locked)
|
|
While it cannot be positioned in 3d space, it can be rotated in all 3 dimensions using the GUI.Matrix. If you really need 3D GUI in 3D space and rotation, I'd recommend one of the sprite based GUI systems available in the forums, and then extending it using the event classes (delegates, etc) available in C#. These are generally much more flexible than the built in GUI, but require a fair amount of work.
(comments are locked)
|
|
"It is my understanding that by tweaking GUI.matrix the right way, I could get my GUI to show up in 3D space... is it true?" That's not true. Unity GUI is 2d only. this is not really true. using GUI.matrix you can rotate GUI things around "in 3d"
Oct 21 '09 at 08:58 AM
Lucas Meijer 1 ♦♦
(comments are locked)
|
