Pawn.FaceRotation() and replication

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
Hi all,

I've got a pawn that runs in PHYS_Flying mode. However I want to restrict it on the roll and pitch axes at times so that it appears it is standing.
This works fine offline by calling faceRotation() from the playerController class.

However in LAN games, faceRotation seems to have no effect as client's pawns always face in the direction of their view (or playerController rotation).

I tried creating a replicated function (lets call it serverFaceRotation) to call from playerController.UpdateRotation() which does the exact same thing as faceRotation(), only it replicates from the client calling it to the server. Now i get a really nasty flicker between the correct rotation and the view rotation of the client's playerController - it seems that serverFaceRotation() is called and then something overrides it straight away... but not so soon that the pawn doesnt set itself to the correct rotation for a split second first.

Is there some native code interfering here? Regardless, how can i stop this jitter from happening?

Cheers!
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
If you want to restrict the Roll and Pitch of your Pawn in a way that will replicate reliably, I suggest you simply set the Rotation to a rotator var whose Roll and Pitch is continually reset to zero or extract the Yaw from the Controller's desired Rotation and set your Pawn to that.
Rotation (like Location) replicates well with Pawns, so using your current method of keeping your Pawn upright sounds unecessary and problematic.
 

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
unfortunately things are a bit more involved than that.
My pawn's rotation can only really be expressed via a quaternion as it is relative to different things at different times. So I'm unable to simply set pitch and roll to 0 to get what I want.