Announcement

Collapse
No announcement yet.

Best use of CharacterMovement for Top Down Shooter?

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

    Best use of CharacterMovement for Top Down Shooter?

    Hi,

    I figured I should take a stab at making a simple "Top Down Shooter" (WASD + Mouse) a'la Alien Swarm or Crimson Land in basic movement. For now, I just tied X and Y speed to input Axis which I tied to WASD.



    Two thoughts on this:
    1. Up and Right (for example) will result in max speed up and max speed right, which is super speed diagonally. A classical input problem, but I'm not sure how to deal with it in Blueprints?

    2. But more than that, maybe this is not a good way to go about it. Is it wiser to use a Direction for the CharacterMovement and only use velocity for it? And then potentially rotate the mesh towards the "crosshair" for strafing, etc.

    Thoughts overall on how to approach this would be appreciated.

    Thanks,
    Attached Files

    #2
    Originally posted by Arcade View Post
    1. Up and Right (for example) will result in max speed up and max speed right, which is super speed diagonally. A classical input problem, but I'm not sure how to deal with it in Blueprints?
    I don't have the editor open at the moment, but there should be a ClampVectorSize node or something along those lines. Just clamp your velocity vector to your desired max speed and it will the work for you.

    Originally posted by Arcade View Post
    2. But more than that, maybe this is not a good way to go about it. Is it wiser to use a Direction for the CharacterMovement and only use velocity for it? And then potentially rotate the mesh towards the "crosshair" for strafing, etc.
    Well, anwsered in the first part, I guess. Should work and we kinda standard for those kind of problems.

    Comment


      #3
      for 1. you can combine both input, get the vector, normalize the vector and then multiply against maxspeed to get your velocity vector.
      Even though it looks like independent event in UE4, but for input I think it's a mix of polling and event.

      2. if you want to have different speed(ie move forward is faster, move back while shooting is slower), then it's better to let your crosshair decides your yaw rotation.
      (I think there is a node to the let rotate character to lookAt certain point.)
      You can always interpolate with a given rotation speed limit. (it's in character class already for maximum turn rate.)
      Unreal Engine 4 Game Framework diagram for relation of all major base object types
      Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
      Resident Evil Classic Camera
      RPCs official document, Must Read
      Everything you should know about replication

      Comment


        #4
        Hey Arcade,

        I have a similar kind of movement system that uses Add Movement Input node. This should give you correct speed while moving diagonally. Here's my setup:

        Click image for larger version

Name:	WASD_movement.png
Views:	1
Size:	86.6 KB
ID:	1053400

        Comment


          #5
          To continue on my last post, here's how I handle character rotation:

          Click image for larger version

Name:	WASD_rotation.png
Views:	1
Size:	177.8 KB
ID:	1053402

          I control my character through player controller blueprint. Inside my character blueprint I have a box that covers my whole camera view and I line trace against this box to get my mouse location. This way I can get more steady control on uneven terrain.

          Comment


            #6
            Thanks everyone for this! Much appreciated.

            Comment

            Working...
            X