Announcement

Collapse
No announcement yet.

Create a rolling ball controller (top-down like "Waves")? Example included.

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

    Create a rolling ball controller (top-down like "Waves")? Example included.

    How would you go about creating a ball you could roll around with the WSAD keys similar to something like this in Blueprint: http://www.youtube.com/watch?v=mP7AOJPLI68#t=42

    I'd like to be able to to similar twin-stick aiming controls as well, but right now I'm focusing on the movement itself first. Thanks!

    #2
    Depending on how you want your controls to work and how much physics you want - you could create a physics based sphere for the ball and apply forces to it bound to the WASD-keys. Or you could make sure the ball has a Movement-component and update it's Velocity variable when using WASD.

    Comment


      #3
      I've been trying to do the physics based method, but I don't know what I would use to apply the forces.

      Comment


        #4
        I'd also really like to know how to accomplish this. Getting hung up on how to apply a force to an object via inputs such as WASD or Joystick Axis.

        Comment


          #5
          Check out something like the third person template, but replace the 'add movement input' nodes with 'add force' nodes!

          I really want to build a 'physics ball' template for next release
          Lead Programmer - UE4 Animation/Physics/Audio Team - Epic Games
          Twitter: @EpicJamesG

          Comment


            #6
            Haven't actually ran this BP but just as a mock up I think this is what you want.
            Set up your input axis mappings like in the picture. The in your BP create 2 MakeVectors, one for horizontal movement and one for forward movement. Add these together and use it as your force. You'll probably want to add a multiplier in there to get more control over the force amount.

            Let me know if this works.

            Comment


              #7
              Here's a level blueprint example I put together with torque instead of force, and using the tick event...although I think the above method's input handling is more sensible

              Comment


                #8
                veggiesaurus I got your method working, but only as a level blueprint. I can't figure out how to apply this to a character, because I'm still confused on the actual character creation process. (As in having the ball as a player with a parented camera.) I've looked at all the documentation, the forums, and even the included top-down template and I'm still confused on how to do it.

                Edit: Wow okay so it turns out I was just forgetting to override the gamemode so I could set the player class. Now I'm stuck on this stupid problem where I will rotate the camera in the player's component view, yet it still faces flat in-game. Anyone know what's causing that?

                Edit 2: Oh okay, I missed the "Use Controller View Rotation." Now I just need to figure out how to constrain the camera's rotation so that it won't be spinning around with the ball like it currently does.
                Last edited by darkpivot; 03-23-2014, 10:46 PM.

                Comment


                  #9
                  So I made some progress on this tonight given the information here. I'm using Add Impulse instead of Force or Torque. What I want is for the ball to accelerate at a constant rate in any direction and cap the speed at a variable limit. I'm sure there's an easier way to do this than what we're trying to do here with the physics based approach... but such is learning the ins-and-outs of an engine as we try to clone a game.

                  Comment


                    #10
                    How are you guys accessing the forces and torque nodes? Is it a specific class you are extending the blueprints from?

                    Comment


                      #11
                      Originally posted by jestersheepy View Post
                      How are you guys accessing the forces and torque nodes? Is it a specific class you are extending the blueprints from?
                      Try searching in the node menu on the right. Check my picture. Sometimes the rightclick context menu doesn't give me what I'm looking for.

                      Comment


                        #12
                        Yeah specifically you need to Uncheck 'Context Sensitive' if you want to search for a node through the right-click menu. Or optionally use the library browser to the bottom right of the Blueprint window.

                        Comment


                          #13
                          Originally posted by jestersheepy View Post
                          How are you guys accessing the forces and torque nodes? Is it a specific class you are extending the blueprints from?
                          Just un-check the "Context Sensitive" box and it will allow access to all the nodes.

                          Also does anyone know how to get a camera attached to the ball so it will follow, but not rotate WITH the ball? I've been trying to figure this out forever. Anything I try just results in the camera spinning all around the level.

                          Also, Impulse works a lot better, but it still feels off. Sometimes it's not registering key presses and I have to press it again for it to go that direction as well, and we still need to figure out how to make it so that when there is no input, it will stop rolling instead of continue.

                          Edit: wheeeeeeeeeeeeeeeeee http://gfycat.com/EarlyTallBordercollie#
                          Last edited by darkpivot; 03-24-2014, 06:12 PM.

                          Comment


                            #14
                            So what I did to prevent the camera tumbling was I added in some dummy components to attach the spring-arm too and another component to serve as the "root" parent.

                            So more specifically: I have a camera that's a child of a spring-arm that's a child of an arrow with visibility set to none. The arrow and the ball are both children of a sphere, also with visibility set to none (really you can use whichever components you want, any primitive will do).

                            Every tick I move the arrow to the position of the ball. It's a dirty work-around but for now it solves the problem.

                            Comment


                              #15
                              Here's a screenshot of my blueprint so far:



                              My setup works with both WASD and and Xbox 360 controller. Just as a note, for whatever reason the Axis is reversed on the controller... which is why I have the Stick X going into Y, etc.

                              What I'm trying to figure out now is how I can cap the speed so that it doesn't just keep accelerating forever.

                              After that, I want to put together a better way to slow down to a stop. You'll notice that in Waves the ball won't immediately come to a stop, but neither does it's momentum affect how quickly it comes to a stop. I don't think he uses physics forces and the more I'm working with them to clone that control scheme, the less I like how complicated it is.

                              Like, even after I get both of those things done, I want to also be able to change direction without having to decelerate before accelerating again. If you move in the opposite direction currently, you have to first apply opposite force to dissipate your momentum to begin traveling in the opposite direction.
                              Last edited by Saeris; 03-24-2014, 07:22 PM.

                              Comment

                              Working...
                              X