I don't need to test my programs. I have an error-correcting modem.

Legacy:FixedMover

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 17:07, 10 May 2004 by Vty229a4.emba.uvm.edu (Talk) (Moved class to separate page...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Movers that rotate in the process of opening or closing (doors, for instance) don't work well in network games; clients may see those movers rotated in ways that don't match their actual rotation on the server. The following class, presumptuously called FixedMover, fixes that problem. (See Embedding Code for how to use it in your maps.)

class FixedMover extends Mover;
 
 
var int RealRotationYaw;
var int RealRotationPitch;
var int RealRotationRoll;
 
 
replication {
 
  reliable if (Role == ROLE_Authority)
    RealRotationYaw, RealRotationPitch, RealRotationRoll;
  }
 
 
simulated event Timer() {
 
  // first problem: rotators not replicated correctly
  if (Role < ROLE_Authority) {
    RealRotation.Yaw   = RealRotationYaw;
    RealRotation.Pitch = RealRotationPitch;
    RealRotation.Roll  = RealRotationRoll;
    }
 
  // second problem: rotation not taken into account when updating position
  if (RealRotation != Rotation)
    bClientPause = true;
 
  Super.Timer();
 
  if (Role == ROLE_Authority) {
    RealRotationYaw   = RealRotation.Yaw;
    RealRotationPitch = RealRotation.Pitch;
    RealRotationRoll  = RealRotation.Roll;
    }
  }