| Home Page | Recent Changes

FixedMover

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;
    }
  }

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In