| Home Page | Recent Changes | Preferences

RotatingMover

UT :: Actor (UT) >> Brush >> Mover (UT) >> RotatingMover

A RotatingMover continuously revolves with its set RotationRate. Start the rotation by triggering it, stop it by untriggering it. (In other words, when a player starts touching a Trigger, the RotatingMover starts moving, and stops when the player leaves the trigger's radius.) Unfortunately, this kind of mover doesn't work online.

If you're trying to create a simple, constantly spinning object, you do not need to set the mover to "RotatingMover" at all. Rather, you can set Object → InitialState to None, and then under Movement, set bFixedRotationDir to true, Physics to PHYS_Rotating, and then configure your desired rotation values under RotationRate.

If you want to use a mover that changes its rotation along its normal movement, just use a normal mover instead.

Network Fix

Unfortunately the RotatingMover class doesn't work in online games; on clients, the mover stands still. The following subclass fixes that. See Embedding Code for how to get it into your maps.

This class also adds a new bEnabled property in the RotatingMover section of the property sheet. Use it to determine whether the mover starts automatically when the game is started or has to be triggered to start.

// ============================================================================
// FixedRotatingMover
// Created 2002 by Mychaeel <mychaeel@beyondunreal.com>
//
// Fixed incompatibility of RotatingMover in network games.
// ============================================================================


class FixedRotatingMover extends RotatingMover;


// ============================================================================
// Replication
// ============================================================================

replication {

  reliable if (Role == ROLE_Authority)
    bEnabled;
  }


// ============================================================================
// Variables
// ============================================================================

var(RotatingMover) bool bEnabled;


// ============================================================================
// BeginPlay
// ============================================================================

function BeginPlay();


// ============================================================================
// Tick
// ============================================================================

simulated function Tick(float TimeDelta) {

  if (bEnabled)
    SetRotation(Rotation + RotateRate * TimeDelta);
  }


// ============================================================================
// Trigger
// ============================================================================

function Trigger(Actor ActorOther, Pawn PawnInstigator) {

  bEnabled = true;
  }


// ============================================================================
// UnTrigger
// ============================================================================

function UnTrigger(Actor ActorOther, Pawn PawnInstigator) {

  bEnabled = false;
  }

In UnrealEd 2.0, the above will not appear when you right-click the Add Mover button. Instead, create a subclass of Mover and use the code below. The right-click of the Add Mover button only seems to gather the subclass of Mover, but not subsequent subclasses thereof. See Embedding Code for how to get it into your maps.

//=============================================================================
// FixedRotatingMover.
// Created 2002 by Mychaeel <mychaeel@beyondunreal.com>
// Modified 2002 by Occam <sm_zero@hotmail.com>
//=============================================================================
class FixedRotatingMover extends Mover;

var() rotator RotateRate;

// ============================================================================
// Replication
// ============================================================================

replication {

  reliable if (Role == ROLE_Authority)
    bEnabled;
  }


// ============================================================================
// Variables
// ============================================================================

var(FixedRotatingMover) bool bEnabled;


// ============================================================================
// BeginPlay
// ============================================================================

function BeginPlay();


// ============================================================================
// Tick
// ============================================================================

simulated function Tick(float TimeDelta) {

  if (bEnabled)
    SetRotation(Rotation + RotateRate * TimeDelta);
  }


// ============================================================================
// Trigger
// ============================================================================

function Trigger(Actor ActorOther, Pawn PawnInstigator) {

  bEnabled = true;
  }


// ============================================================================
// UnTrigger
// ============================================================================

function UnTrigger(Actor ActorOther, Pawn PawnInstigator) {

  bEnabled = false;
  }

Please note the mover's InitialState must be set to None in order for the Triggering function to work properly. Any other setting will mean the mover can not be triggered on in-game. Having the mover's InitialState set to None gives a "TriggerControl" effect (While the trigger is activated, the mover is enabled).


Category Class (UT)

Category Custom Class

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

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