Announcement

Collapse
No announcement yet.

Problem With Character rotation on Client

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

    Problem With Character rotation on Client

    Hey Everyone. I Have been trying to figure this out for about 3 days now and have NO luck. So i'm trying play around with networking with a top down style game. the characters rotation follows the mouse location. The character always faces the mouses direction. It works perfect on the Server and i can see the servers character rotating on the client screen, but I just cant get my clients character to rotate. when playing with a dedicated server I cant get any rotation from any client characters.so whats the deal? Below are some blueprints of what i have so far.Click image for larger version

Name:	GjOVzIT.png
Views:	1
Size:	232.3 KB
ID:	1149501

    Click image for larger version

Name:	En6lPkL.png
Views:	1
Size:	176.2 KB
ID:	1149502

    Click image for larger version

Name:	omRTLx4.png
Views:	1
Size:	143.1 KB
ID:	1149503

    Click image for larger version

Name:	iMMVXip.png
Views:	1
Size:	58.2 KB
ID:	1149504

    I have no idea what i'm doing so if these blueprints are very bad feel free to tell me. id much rather start from scratch then spending another 3 days trying to find the answer. Although i value all of your suggestions and anything would help, if you can provide a blueprint example of the points you are trying to get across that would help me tremendously. Thank you all!

    #2
    Ouch.. 3 days? don't be shy xD we are here to help

    The server and client are probably both replicating the mouse location at the same time so seems the server-side pawn (all pawns which have a client, also have a server side) overrides whatever the client tries to send.

    If you are going to update the rotation per tick, then it would be a good idea to use the character movement component (which already handles replication) instead of doing all that "manual" stuff
    I can make an example project for you if are still having trouble with this.

    4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
    WIP Interactive Water Shader, WIP 2D Water Sim
    WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

    Comment


      #3
      thanks for the quick reply! ill give it a shot and then let you know if i still need a blueprint!

      Comment


        #4
        Originally posted by TK-Master View Post

        If you are going to update the rotation per tick, then it would be a good idea to use the character movement component (which already handles replication) instead of doing all that "manual" stuff
        How do i use the character movement component for my rotation?

        Comment


          #5
          I found a RotatingMovement Component. is this what I am supposed to use? I guess i am just very unfamiliar with what I've gotten myself into haha. I'm not even sure how to use the rotating Movement Component or the CharacterMovement component.

          Comment


            #6
            You need your player blueprint to be based on the Character class in order to use the CharacterMovement component (the character blueprints for most of the example projects such as ThirdPerson, FirstPerson, TopDown etc. uses this).

            I used the TopDown example as test and I was able to do this by adding this into the TowDownCharacter BP:

            Click image for larger version

Name:	TopDownMouseRotation.jpg
Views:	1
Size:	130.5 KB
ID:	1075920
            Make you have "Use Controller Desired Rotation" enabled in the CharacterMovement component.
            Then make you set the camera to be facing directly down (-90 degrees on the Y axis of the spring arm) or else you will probably have to do a trace instead of using FindLookAtRotation.

            Also I deleted all the stuff from the TowDownController BP, you only need to enable the mouse cursor in there.

            Let me know if you have any problems!

            4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
            WIP Interactive Water Shader, WIP 2D Water Sim
            WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

            Comment


              #7
              Sorry, I just realized there is a better way.. you can simply add this into the TopDownController blueprint instead of my previous example:

              Click image for larger version

Name:	TopDownMouseRotationController.jpg
Views:	1
Size:	146.9 KB
ID:	1075926
              And since we are using GetHitResultUnderCursor instead of mouse coordinates we can have any camera rotation we want (no need for it to be directly facing down).

              Keep in mind, you still need the character movement in you character blueprint with "Use Controller Desired Rotation" enabled.

              Enjoy

              4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
              WIP Interactive Water Shader, WIP 2D Water Sim
              WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD

              Comment


                #8
                Originally posted by TK-Master View Post
                Sorry, I just realized there is a better way.. you can simply add this into the TopDownController blueprint instead of my previous example:


                And since we are using GetHitResultUnderCursor instead of mouse coordinates we can have any camera rotation we want (no need for it to be directly facing down).

                Keep in mind, you still need the character movement in you character blueprint with "Use Controller Desired Rotation" enabled.

                Enjoy
                wow.. this was much simpler than I expected it to be. It is working just dandy now. THANK YOU! this really helped me!

                Comment


                  #9
                  ok so turns out it has caused my character to move relative to the character instead of relative to the world like id like for it to. for example. I press 'w' to move forward 5 meters, then I turn 90 degrees to the left and the pressed 'a' to move left 5 meters. I would end up where i started. any idea how to fix this?

                  Click image for larger version

Name:	Movement relative to character.png
Views:	1
Size:	161.3 KB
ID:	1075945

                  This is how I handle movement. I can see how this would cause a problem since i'm getting the control rotation.

                  EDIT: Well I fixed it. I used a make rot node and just left all of the values at default '0.0'. it seemed to solve the problem. seems a little unorthadox though haha. :P
                  Last edited by beanswaggle; 05-07-2015, 09:03 PM.

                  Comment

                  Working...
                  X