GUI in 3D Scene

fkrickfkrick Posts: 2Member

Hi folks,

i am new to godot and this forum :D

Currently i am working on a small game in 3D that requried an menu displayed on a mesh, so far i know that can be done in godot.
But i am struggeling a bit i use these great demo: https://github.com/godotengine/godot-demo-projects/tree/3.0-d69cc10/viewport/gui_in_3d

But if i scale the the node "Quad" and the CollisionSpae inside the Area than the raycast return the wrong cooardinates for the Viewport, how i can handel this issue and why thats happen ?

If you need any example code, i just use the demo and try to modify the scale fomr "Quad" and the collisionShape

best, Flo

Answers

  • MegalomaniakMegalomaniak Posts: 3,997Admin
    edited January 2019

    Apparently you are not the only one with this issue:
    https://github.com/godotengine/godot-demo-projects/issues/294

    @GarromOrcShaman You figure this out, or it remained an issue without solution/work around?

  • fkrickfkrick Posts: 2Member

    Oh, nice to know :) put a Notifications-Subscription on this git issue.

    thanks Megalomaniak :)

    best, Flo

  • MegalomaniakMegalomaniak Posts: 3,997Admin
    edited January 2019

    OK, so I took a closer look at the demo.

    Strictly speaking for what you want to do you should be creating your quad in code to the exact shape and size you want at that exact moment, same basically goes for that viewport. So you can then create a viewport of resolution/size that will fit the size of the quad you have created according to the needs that are defined by the specific menu you are intent on creating.

    Each menu itself should be a scene of it's own you instance under the viewport then in turn. So the good news here is you can create the menus themselves through the editor rather than code.

    This is definitely doable, but it can and will get complex in real world scenarios, and honestly even in a simple example. I might be willing to take some time and modify the demo into an example of this, but I'll have to take some further time to think about and experiment with it to create a (hopefully) clear example of this.

    That is to say if I understood correctly what you actually want to do. I could very well be misunderstanding you.

  • TwistedTwiglegTwistedTwigleg Posts: 4,793Admin
    edited January 2019

    Well, I have fixed almost all of the issues relating to different quad sizes and mesh instance node scales. Most of the issues stemmed from the process of translating from world space to viewport space, and how drag events events are calculated. Honestly the code was kinda a mess.
    (Sadly, I was the one that ported the demo from Godot 2.0 -> Godot 3.0, so... :sweat_smile: )

    I've cleaned up the code and made some changes so it works with different mesh sizes and with scaled nodes. The only thing that is not working 100% is drag events, as a normal InputEvent does not provide quite enough data to make a completely transition, so the code has to fill in the gaps a bit which can lead to strange behavior with scaled nodes. But other than that, now the demo should work with varying quad and viewport sizes.


    Unfortunately, I'm stuck having to make a Linux virtual machine on my computer because Windows is having really strange file case issues with one of the materials in the IK demo, which is preventing me from making a pull request. As far as I can tell, the way to resolve strange file case issues on Windows is to use another OS instead of Windows, which is not terribly helpful.

    But now I'm installing Ubuntu on a virtual machine, so it should work from there. I just wish it didn't take a couple hours of researching and attempting fixes to get there, but ah well. Anyway, the PR should be up soon!


    Edit: Okay, the pull request is submitted. It should work with different viewport sizes, quad sizes, and it mostly works for scaled nodes. Hopefully it will fix the majority of the issues the old version had :smile:

  • MegalomaniakMegalomaniak Posts: 3,997Admin
    edited January 2019

    @TwistedTwigleg One last tweak, if i may request: Select the Quad node, go to material and tick the transparency flag.

    edit: Right, just realized I added a panel container to the GUI demo on my end, so might not work as well without it.

  • TwistedTwiglegTwistedTwigleg Posts: 4,793Admin
    edited January 2019

    @Megalomaniak said:
    @TwistedTwigleg One last tweak, if i may request: Select the Quad node, go to material and tick the transparency flag.

    I can totally do that :smile:

    I initially meant to have transparency on, but to debug the conversion process I turned transparency off so I could see the edges of the quad. I’ll make the change and add transparency in a bit.

    Edit: the change is done! Thanks for the suggestion :smile:

    edit: Right, just realized I added a panel container to the GUI demo on my end, so might not work as well without it.

    I do not think it should make a difference, but I’d have to test to know for sure. UI/GUI stuff still confuses me most of the time, especially when you throw in viewports.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file