Announcement

Collapse
No announcement yet.

[beginner] Interacting with my object

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

    [beginner] Interacting with my object

    Hi, im kinda new in UE4 and I need to do something that may be simple for you but hell for me.. In my game prototype, I have severals ball that spawn and I want to create a function that when I press the key E (or any key in fact its doesnt really matter for now) the ball will 'fly' midair to my character and follow him, like hes holding it but withouth the animation (that'll come later) but i have no idea how to do it.. thanks very much. Note: I Need to do my function in MainGameMode if it can change anything

    Edit : its a 3rd person game
    Last edited by Olimar; 04-06-2015, 03:11 PM.

    #2
    I can forgot the 'fly in midair' i just want the ball to follow me when im near to it and press a key and i still have trouble on how to figure it out ;s

    Comment


      #3
      You can set a key binding action for "E" called "StartFlying" (or whatever). Then bind the "StartFlying" action to a Timer, which calls a new function "FlyToPlayer". In "FlyToPlayer" you can use "Find Look at Rotation" to take the ball position and the player position, and then use this to move the ball. To actually move the ball, you can use the function "Set Actor Location" to add a delta value toward the player (use "Get Forward Vector" on the result of the balls rotator). You may need to scale this value to get the right motion. Then make sure you clear the timer at the end. While there are probably 15 different ways to do this, maybe this will give you some ideas.
      check my blog - cybereality.com

      Comment


        #4
        Originally posted by cybereality View Post
        You can set a key binding action for "E" called "StartFlying" (or whatever). Then bind the "StartFlying" action to a Timer, which calls a new function "FlyToPlayer". In "FlyToPlayer" you can use "Find Look at Rotation" to take the ball position and the player position, and then use this to move the ball. To actually move the ball, you can use the function "Set Actor Location" to add a delta value toward the player (use "Get Forward Vector" on the result of the balls rotator). You may need to scale this value to get the right motion. Then make sure you clear the timer at the end. While there are probably 15 different ways to do this, maybe this will give you some ideas.
        First of all thank you! unfortunatly i'm not sure i can do all that, for now in my event graph I have a '' E node that bind to my 'PickUp' function, but for the rest im kinda lost here what i started using what you said Click image for larger version

Name:	fly.png
Views:	1
Size:	350.3 KB
ID:	1072071 (since its 2 am in EST i will answer tommorow.. and yea i know i'm bad :v)

        Comment


          #5
          Here is a way to do it:

          Ball Bp

          Click image for larger version

Name:	c48.PNG
Views:	1
Size:	305.2 KB
ID:	1072079

          GameMode

          Click image for larger version

Name:	c49.PNG
Views:	1
Size:	288.3 KB
ID:	1072077
          Website [ LINK ]
          Twitter [ LINK ]
          Support ! [ LINK ]

          Comment


            #6
            I am interested in this as well. Can anyone alse elaborate on this?
            -----------------------------------------------------------
            3SORiN Games llc.
            www.3SORiNGames.wordpress.com
            PROJECT: PEACEKEEPER
            -----------------------------------------------------------

            Comment


              #7
              Originally posted by Mhousse1247 View Post
              Here is a way to do it:

              Ball Bp

              [ATTACH=CONFIG]33955[/ATTACH]

              GameMode

              [ATTACH=CONFIG]33953[/ATTACH]
              wow thank so much

              Comment


                #8
                Click image for larger version

Name:	ball.JPG
Views:	1
Size:	74.6 KB
ID:	1072119 I still have 2 mini question about it if I understand well.. The first BP goes in my ball BP right? and the second maingamemode?

                And in the first BP i cant find the thow 'x' node, what are they called? and in the second BP why my set player doesnt have the target in it?
                Last edited by Olimar; 04-07-2015, 06:38 PM.

                Comment


                  #9
                  Do you know why my last set with go to player cant have a target node ? like in your example, its the only thing I Cant get to test it :'(

                  Comment


                    #10
                    you have to drag it from "ArrayElement" (Set "Go To Player") and your Ball_Bp must have this bool variable inside it
                    Website [ LINK ]
                    Twitter [ LINK ]
                    Support ! [ LINK ]

                    Comment


                      #11
                      Thanks!! but here what i did : Click image for larger version

Name:	ball2.JPG
Views:	1
Size:	190.3 KB
ID:	1072122 Click image for larger version

Name:	ball3.JPG
Views:	1
Size:	105.2 KB
ID:	1072123 and nothing happens ;s do you have an idea? (Urbas is the name of the ball) or maybe im doing it wrong, im facing a ball with my 3rd person character and nothing happens when i press F
                      Last edited by Olimar; 04-07-2015, 07:31 PM.

                      Comment


                        #12
                        in your graph "go to player" is setted to false , set it to true
                        Website [ LINK ]
                        Twitter [ LINK ]
                        Support ! [ LINK ]

                        Comment


                          #13
                          Originally posted by Mhousse1247 View Post
                          in your graph "go to player" is setted to false , set it to true
                          Yea sorry i took the picture too fast but its already setted to true

                          Comment


                            #14
                            and make sure you setted your speed and min distance variables
                            Website [ LINK ]
                            Twitter [ LINK ]
                            Support ! [ LINK ]

                            Comment


                              #15
                              oops yea i forgot those :v i set my sped to 20 and distance to 200 (maybe i use wrong one?) and still nothing ;s I'm sorry i feel bad

                              Comment

                              Working...
                              X