Announcement

Collapse
No announcement yet.

Floating/moving UMG widget?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Floating/moving UMG widget?

    I'm trying to make a strategy game and need some help with UMG.

    When clicking on buildings, npc etc. I want a info box showing with infomation about the actor..

    I got it showing a UMG widget in the center of the screen and displaying information from my actor blueprints when I click on the buildings..

    Made a quick video on youtube:


    The problem is I want the UMG widget "floating" so it moves with the camera and showing the direction of the buildings selected.

    I've recorded a video of sim city showing what I want to do:


    Do anyone know how to make something like that?

    #2
    Create small "info blueprint", all it should have is some invisible root component (can be capsule, trigger box, arrow, anything that you can hide in game and can use world location).
    Then on top of that "invisibl root" add "umg widget component (its experimental but works quite well). Set that widget to your info umg blueprint, set it also to screenspace.
    When you click on object show that widget and set its world location to in game object location.

    Now there is some small quirk about all this.
    If you are making singleplayer, then you can either add that widget to all buildings in game and display it. Or make it as blueprint that is tracing player mouse etc.
    But if you are making this game as multiplayer that widget must be visible to owning player only. Which means you should add it to same pawn as camera.
    Last edited by Nawrot; 06-09-2016, 07:32 AM.

    Comment


      #3
      Great thank you.

      I will try to see if I can get something working with the method you described.

      I've decided on not making it multiplayer, still learning and multiplayer replication have always given me problems.

      Comment


        #4
        Okay I have been playing around with the method you described and got this:



        The problem is I still don't know how to constrain the UMG widget inside the screen like in SimCity and perhaps even make the widget spawn "next" to the building like in the simcity video i made.

        Comment


          #5
          To constrain it you would need to modify the implementation of the widget component shared world space panel in C++. The default implementation only knows how to project into screen space, doesn't know how to do anything fancier. Either that - or do something completely custom, moving a widget on the screen based on completely custom logic, and not trying to use the widget component at all.

          Comment

          Working...
          X