Announcement

Collapse
No announcement yet.

Shoot at mouse

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

    Shoot at mouse

    I have been trying to setup a bullet that fires at the mouse location however I am having a problem figuring out how to make a rotation that works properly.

    Here is the basics of the blueprint I am using.
    Attached Files

    #2
    You need to get the location information for the mouse cursor, not the character/controller.

    Comment


      #3
      https://www.youtube.com/watch?v=FvFEvxGQjug

      Comment


        #4
        I tried that tutorial however it didn't work for me, here is what I have so far in the blueprint, and the projectile fires... in all sorts of random directions

        Video of the blueprint in action

        http://tempestintheaether.org/public...-21-40-662.avi
        Attached Files

        Comment


          #5
          Why don't you print string the starting location information right when the bullet spawns(bullets rotation, etc...) And compare that to the actor/mouse information. In my game, the location node from break hit results gives me incorrect numbers, so I had to minus some random number like 13350.257 z to get the correct location. If you also have this problem hiding, you will see it by printing string. I suggest you click on an object that is at 0,0,0, and print string to see what the break hit results location says.
          Marketplace Assets

          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

          Comment


            #6
            Here is the result.

            Not quite sure what I should be getting but it seems that it sorta works on the objects if it was top-down however it doesn't work as a side angle. However it doesn't work at all when there is no object to hit.

            http://tempestintheaether.org/public...-21-55-761.avi

            Blueprint is attached as well
            Attached Files
            Last edited by Botanicvelious; 04-28-2015, 04:37 PM.

            Comment


              #7
              Well, I'd need to also see the printed results for the cursor's location & rotation, not just the actor's. Could you do that? If you plan on recording another vid for me, make the cursor info a different color than the actor info. If I see that info I should be able to figure out a pattern.
              Marketplace Assets

              Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
              Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
              Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

              Comment


                #8
                First off thanks for all the help so far

                I think I got all the items you could need in this, color coded them so its easy to see etc.

                http://tempestintheaether.org/public...-41-42-021.avi

                Also attached the whole bp so you can see exactly what everything is
                Attached Files

                Comment


                  #9
                  Hmm... Not sure. Sorry to be a bother, but could you also print your character's location? And try setting a solid rotation for the projectile such as 90, 0, see if those function properly, and report back. If I get character's location during these clicks I should be able to do the math and see what angle you get, and what angle you SHOULD BE getting to figure out if there is some additional math factor that is behind the scenes, or if you are doing something wrong (or right).
                  Marketplace Assets

                  Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                  Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                  Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                  Comment


                    #10
                    If I were to guess, what seems to be happening if i were to guess is that the "get hit result under curser by channel" works properly as if it was a top-down, however when it is turned to a side-scroll i don't get the result i need. I looked at the position of the mouse and when i click on a platform it shoots out from the character at approximately the direction it would go if the character was top-down, however as its from the side it shoots at the camera, rather then at the mouse.

                    Also it seems that the backdrop is causing issues as the positions of the background is way different then the platforms which causes the weird rotations when i click on the sky.

                    Also if i were to guess the "set Velocity in Local Space" is not correct.



                    For the items you asked for, when i set pitch to 90, i get the projectile firing off directly to the left, yaw to 90 it shoots directly at the horizon line, roll to 90 it shoots through the floor. I recorded a video at http://tempestintheaether.org/public...s/pyr-test.avi


                    Latest video with actor location printed in yellow, http://tempestintheaether.org/public...-19-33-313.avi

                    Comment


                      #11
                      Yep, I am using the 2DSideScroller template, and I have to minus 205.812 x, and 144.212 z to even get the correct hit location of where it is REALLY hitting, might be just a bug with the template.

                      Here's what I found: The numbers/angles of shooting you are getting make sense, but are still a bit confusing. I am comparing the red number to the yellow number in this calculator: https://www.easycalculation.com/alge...ctor-angle.php

                      I'm not completely sure what the relation mathematically is, or the pattern; I suggest you try swapping a variety of the rotation variables, for example: use pitch in place of yaw and yaw in place of pitch(break rot from the get rotation node). See what combination gets your projectiles more accurate(if any). If this doesn't work, I suggest you do what I do, place an item at 0,0,0. And trace to it, make sure that your printed location string matches 0,0,0. If you click on 0,0,0 and get some trace like -50, 18.2, 9. Then subtract those numbers from your location return node on break hit result so that they = 0. This is what I had to do. If you have any luck, let me know. Hope I helped!
                      Marketplace Assets

                      Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                      Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                      Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                      Comment


                        #12
                        Well i gave up on using the built in functions and made my own with some basic math and it works.

                        If anyone ever comes across this here is the blueprint that worked for me.
                        Attached Files

                        Comment


                          #13
                          Alright, well I'm glad you figured it out, thanks for posting the working blueprint
                          Marketplace Assets

                          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
                          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
                          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

                          Comment

                          Working...
                          X