Announcement

Collapse
No announcement yet.

How to properly replicate character rotation? (for a "look at mouse" mode) Server rotates faster.

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

    How to properly replicate character rotation? (for a "look at mouse" mode) Server rotates faster.

    First thread here! Love UE4. I'm an artist by trade but blueprints is allowing me to delve into actual development a bit (for fun). Especially networking is still pretty new to me.

    Trying to replicate rotation of my characters properly for a "strafe mode". I got it kinda working but for some reason the server rotates faster than the client (or the client rotates slower)

    You hold shift and then rotation dependent on movement is taken over by a rotation towards the mouse cursor (diablo-like top down game)
    But no matter what I do, I can't fix nor wrap my head around why the rotation is slower on clients (about half speed I think). I've found similar questions but when there's a response I don't get it nor can I seem to use that info to fix it.

    I've made a video (easier) walking through my implementation here:



    Thank you in advance! I'm totally lost here and have been for a while now...!
    One man developer on "We who are about to Die"
    Official Subreddit
    Youtube - Twitter - Facebook

    Freelance Illustration & Concept Artist - for hire.
    http://jordylakiere.com/

    #2
    If you are using character blueprint you do not need to replicate rotation.
    Just set character to NOT "orient to movement direction", and set it (blueprint) to replicate.
    Then move character by "add input movement" and "add input yaw" or something like that.
    Character should be replicated quite good together with rotation and almost accurate animations.

    Your faster server rotation may come from that you rotate character on client (that is replicated) then rotate it second time on server. So server has twice the rotation of clients.
    Replication is totally not easy.

    Comment


      #3
      Thanks for replying!

      Hm, I didn't know of this node. Just messed around with it and noticed when I fed it a simple input of 5 degrees every tick (to test) it actually rotates, replicated automatically et all, but jitters/twitches back and forth for some reason.

      I'm messing around now with just using "set control rotation" without any RPC's or network nodes/events at all, and that actually seems to work, so this control rotation stuff seems to be replicated automatically but setactorrotation isn't? I still don't really know/understand the difference. I'm not sure what controller rotation is/what its for, etc.


      (worth noting both input controller yaw and set control rotation nodes only work when "use controller desired rotation" is true under movement component, so I have to toggle that on alongside turning off OrientToMovementDirection)
      One man developer on "We who are about to Die"
      Official Subreddit
      Youtube - Twitter - Facebook

      Freelance Illustration & Concept Artist - for hire.
      http://jordylakiere.com/

      Comment


        #4
        Yes, if you have "orient To movement direction" set to true and try to overwrite rotation you get jittering.
        There is also "use desired rotation" which has very misleading name, it should be "use desired speed rotation" and desired rotation is actually "desired rotation rate". so if you set that to true and set desired rotation to for eg [0,0,90] it will do 2 things: block rotation at first 2 axes, and make 3rd (yaw) rotation smooth.
        That desired rotation thing works very well togetheer with "orient To movement direction" it makes pawn rotate more naturally.

        Comment


          #5
          https://answers.unrealengine.com/que...#answer-818854

          Comment

          Working...
          X