Announcement

Collapse
No announcement yet.

Spawn actor from Hud in mouse position

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

    Spawn actor from Hud in mouse position

    I need a Help on one thing that is taking me months to find a solution. I created a Hud where I display some buttons, and one of this buttons shows an iccon of one actor that can be spawned. The problem is that I want this actor to spawn at mouse location, when I do a hit box end cursor over, and I couldn't make it to spawn the actor on the mouse position yet. Any help on this please? Is something similar to Clash Of Clans construction of villages

    #2
    Break it down into steps , first when the user clicks the character icon , get it to close the widget so that you can see the level again,

    then get the mouse position and store this in a vector variable,

    lastly spawn actor at location use the make transform node and link it to the mouse position vector you created earlier .

    This will spawn the actor at the location of the mouse when the variable was saved .

    If you wanted it to update as the mouse moved then you would probably need an event tick that continually updates the mouse position vector variable .

    Or there might even be an event that already exists like "onMouseMoved" inside here you could make it get the mouse position and save it so this way it would only be called if the mouse moves rather then every frame(event tick)
    Last edited by EniGmaa; 09-04-2015, 04:36 AM.

    Comment


      #3
      I created this HUD with HUD class, not UMG, the box icon is drawn with a hitbox

      Comment


        #4
        Oh I see then I can't help you sorry , I've never used hud and don't think I will . UMG widgets do everything a hud does but just easier and more options to customise it.

        Comment


          #5
          Originally posted by EniGmaa View Post
          UMG widgets do everything a hud does but just easier
          Apparently UMG doesnt work in VR(stereo), so theres a pat on the back for regular boring old HUDS
          https://play.google.com/store/apps/d...m.CrazyRagdoll
          https://play.google.com/store/apps/d...sm.zombieultra
          https://play.google.com/store/apps/d...sm.cubecrawler
          https://play.google.com/store/apps/d...pspasm.turrets

          Comment


            #6
            I did a tutorial for this very thing. Take a trip to my blog and look for the post entitled "Hud to Scene Interaction". I even used the old HUD class for it. (made before UMG) Hopefully it'll help.
            Looking for blueprint tutorials? Then visit my blog... voxagon

            Comment


              #7
              Originally posted by pattym View Post
              I did a tutorial for this very thing. Take a trip to my blog and look for the post entitled "Hud to Scene Interaction". I even used the old HUD class for it. (made before UMG) Hopefully it'll help.
              I worked with UMG to make the start menu, and I noticed that it doesn't give much event options to the buttons you draw, like event hit begin, hit release, begin touch, leave touch, etc...
              I will take a look on your blog when I get to my computer

              Comment


                #8
                Originally posted by pattym View Post
                I did a tutorial for this very thing. Take a trip to my blog and look for the post entitled "Hud to Scene Interaction". I even used the old HUD class for it. (made before UMG) Hopefully it'll help.
                Hey pattym, I worked a little on this and the result I got is this:
                I have 5 spawnable actors that I switch between the icons on my Hud Hitbox, the first actor showed in the Icon spawns at XYZ= 0 on the grid, but if I drag the mouse to the grid the actor follows it, as if had spawned in the pointer position, I'm ok with that, but the other 4 actors spawns at the Pawn location (that I created just to move the camera around) and I have to grab the actor for it to folow the pointer position. the spawn location that I used is like this:
                Click image for larger version

Name:	spawn location.PNG
Views:	1
Size:	118.3 KB
ID:	1087505
                Any help on this?
                I just need to finish this to get my game done, oh, and also testing it on android and IOS, that is another problem that I have because I'm getting erros when packing it.

                Comment


                  #9
                  Bump? Still looking for a sollution for a problem that seems simple to resolve

                  Comment


                    #10
                    Here's a link to a problem I have but it contains my blueprints which pretty much do what you want. I hope it helps. Especially blueprints 1 (spawn actor) and 2 (follow mouse). Blueprint 3 is to drop the actor.

                    https://forums.unrealengine.com/show...ors-don-t-fire

                    And if you can help with my problem...even better.

                    Comment

                    Working...
                    X