Unreal Developer Network Technical
Welcome to the Unreal Developer Network The Engine Unreal Powered Content Creation Technical Playstation2 Xbox Gamecube Licensee Log In

Technical

Technical home

Documents listed below, but not hyperlinked, are restricted to engine licensees only.

As certain texts become relevant, due to released games using that technology, new documents will be made available. Check back often!
 
Getting Started
   - WhatToReadFirst
   - WhoDoIAskAbout
   General Engine Support
   - UnProg (mailing list)
   - UnProgTraffic (summaries)
   - UnDevIRC (chat)
   - UnDevIRCTraffic (summaries)
   Codedrop-Specific Support
   - NextCodeDropStatus
   - UDNBuildIntro
   - UDNBuildReports
   - CodeDrop2226
   - CodeDrop2110
   - CodeDrop927
   - CodeDrop829
   - Patch777PS2
   - CodeDrop777
   - CodeDrop739
   - CodeDrop697
   HW/SW Support
   - RecommendedHardware
   - RecommendedSoftware
   - AthlonLockups
   - ImmersionForceFeedback
   - BelkinSpeedPad
   Toolchain Support
   - UtraceDebugging
   - VTuneUsage
   - VisualSourceSafe
   - UnrealScriptHighlighting
   - VisualStudioAddIns
   - UnrealToolsAddin
   - UnrealToolsDotNet
   - UnrealDebugging
   - UnDox
   - AutoDiff
   - SearchUCinXP
   - EnhancedPkgCommandlet
   - UnrealScriptDebugger
   - BuildingUnrealOnLinux
   - NoStepInto

Unreal Specifics
   - NewProjectPreparation
   Basics
   - UnrealScriptReference
   - UnrealClasses
   - CollisionHash
   - UnrealStrings
   - MemAlloc
   - ConsoleCommandLineParameters
   - UccCommandlet
   - IniFilesTutorial
   - SaveConfiguration
   - GameRules
   - UmodInstaller
   - UmodWizard
   - CreatingGameInstallers
   Rendering Architecture
   - RenderingPipeline
   - CameraEffects
   - TypedTextCameraEffect
   Skeletal System
   - UWSkelAnim
   - UWSkelAnim2
   - ExtendingUWSkelAnim
   - SkeletalAttachments
   - SkeletalBlending
   - AdditionalSkelNatives
   - PhysicsBasedAnim
   - AnimNotifies
   - BinaryFormatSpecifications
   Physics
   - PhysicsOverview
   - RootMotionPhysics
   Particle System
   - ParticlesInfo
   - RibbonEmitter
   - ParticleExtensions
   New Particle Editor
   - ParticleSystemEditorCode
   User Interface
   - HeadsUpDisplayTutorial
   - InteractionReference
   - CanvasReference
   Materials
   - MaterialTricks
   Projected Textures
   - ProjectorTricks
   - RenderToTextureShadows
   - RenderToTextureShadows2
   UnrealScript
   - UnrealScriptDelegates
   - ScriptQuats
   - ConditionalCompilation
   - AsyncFilePackage
   UnrealEd
   - AnimatedTextureBrowser
   - ViewCorrected3DDrag
   Networking
   - NetworkingTome
   - PlayerReplicationHandout
   Terrain
   - TerrainChanges927
   Other Stuff
   - PathingImprovements
   - GameAndAIHandout
   - SubmitBugReport
   - GraphsAndMemory
   - BumpMapping
   - MakeYourOwnDemoMode
   - ExportGeometryIntoMAX
   - InGameMovies
   - CustomArchives
   - LicenseeCodePool
   - LicenseeFileExtensions

Misc
   - CodeDropSong
   - UptBenchmarks

mathengine.gif
Karma Physics
   - KarmaReference
   - VehiclesInUT2003

Contribute!
You can create a new page, and then you can edit this list to add it to the categories, as well as edit the Technical homepage to tell everyone about it!

Make Requests!
You can also stop by the UdnStaff page to see what we're working on, and edit it to add your own document requests.


Please take note! For mod developers working with Unreal Tournament 2003, this documentation is meant to be a starting point for your own explorations into UT2003, not a definitive guide. There will be differences between the documentation here and the product in your hands, and you may have to figure out quite a bit for yourself. Check out the Unreal Tournament 2003 page in the Unreal Powered area for links to community sites if you're having problems. UDN is a licensee support site, and cannot provide technical support or game-specific assistance to end users.

ProjectorTricks

Licensees can log in.

Interested in the Unreal engine? Check out the licensing page.

Questions about UDN itself? Contact the UDN Staff.

Projector Tricks

Revision history:

  1. Written by Nathaniel Brown 12/21/01.
  2. Updated to fix some code issues.
  3. Updated to add another example class.

Introduction

Here I'll be going over a few projector tricks that will hopefully be useful to you. These are basically "dynamic projectors" you can use. The two-example classes I provide here are DynamicProjector, and ExpandingProjector. I'll get into these in more detail below.

Projectors at a glance

For those of you who are unfamiliar with projectors, they basically allow you to project a texture onto any BSP, Staticmesh, Vertmesh, Skeletalmesh, or terrain surface (and soon hopefully particles also). They are useful for faking lighting effects, and decals, amongst other things.

The projector functions I use here are pretty self explanatory, but I'll give a brief description anyway.

AttachProjector(): This function allows you to attach a projector to a surface. It will trace forward a number of units equal to the MaxTraceDistance variable, in a direction based on its rotation.

DetachProjector(): This functional removes the projector from a surface, which is highly useful if you need to update a projector's properties incase they have been modified since last calling AttachProjector().

AbandonProjector(): While I don't use this function in this article, I think its worth noting. It allows you to turn off the projector after the amount of time passed into it elapses, basically leaving the texture attached to the surface while disconnect the Projector (actor) from it (for performance).

Note: It is a lot more expensive to move a projector than it is to actualy render it, although it is less so than UT's decals.

Dynamic Projector

DynamicProjector is useful for instances inwhich you want to have a projector move (for laser scopes, or if based on an object). This relatively simple class just does a check to see if its location or rotation has changed since last tick (OldLocation/OldRotation). If so, it detaches itself from the surface (DetachProjector()) and then reattaches (AttachProjector()), so it correctly updates to the new surface. This is especially beneficial if you want a projector to fully rotate (i.e phys_rotating + bFixedRotationDir + valid RotationRate), because a normal projector can only rotate about its Roll.

//=====================================================================
// DynamicProjector.
//=====================================================================
class DynamicProjector extends Projector;
                                 
var vector  OldLocation;
var rotator OldRotation;

simulated function Tick(float DeltaTime)
{
  if ((Location != OldLocation) || (OldRotation != Rotation))
  {
    DetachProjector(True);
    AttachProjector();
  }
  OldLocation = Location;
  OldRotation = Rotation;
}

Expanding Projector

This little class allows you to make a projector that expands outward. This is best used as a sort of decal, and is really good for things like an expanding pool of blood or water. Essentially, this class will increase the size of the projector until it reaches EndScale plus the original DrawScale based on GrowRate.

GrowRate: This determines the speed at which the Projector scale increases.

EndScale: This is an offset from the initial DrawScale, which is used to determine the Projectors end size.

Note: It's highly recommended that the material used by this Projector has its UClampMode and VClampMode set to TC_Clamp. Also for most decals-like effects you will probably want to have an FOV of 0.

//=============================================================================
// ExpandingProjector.
//=============================================================================
class ExpandingProjector extends Projector;

var() float  GrowRate,
             EndScale;

simulated function Tick(float DeltaTime)
{
  local vector HitNormal,
               HitLocation,
               Dir;
  local float  Distance;

  if (DrawScale < (EndScale + Default.DrawScale)
  {
    DetachProjector(True);

    Dir    = Location;
    Dir.Z -= 70 * 10;
    Trace(HitLocation,HitNormal,Dir,Location);
   
    SetLocation(HitLocation);
    SetRotation(rotator(-HitNormal));

    Distance = Drawscale + (GrowRate * DeltaTime);

    SetDrawScale(Distance);
    AttachProjector();
  }
}

Triggered Projector

This class can potentially be extremely useful. It could be used for blinking lights, or lightning flashes through a window, or many other similar things. The basis is that it simply attaches and detaches when triggered (a toggled effect).

bInitiallyOn: This property allows a Level Designer to specify whether this should be on from the start. Otherwise it doesn't become visible until triggered.

bIsOn: bIsOn serves the simple puprose of indicating whether the projector is currently triggered on or off.

//===================================================================
// TriggeredProjector.
//===================================================================
class TriggeredProjector extends Projector;

var() bool bInitialyOn;
var   bool bIsOn;

function PostBeginPlay()
{
  AttachProjector();
  if (bProjectActor)
      SetCollision(True,False,False);
  bIsOn = bInitialyOn;
  if (!bIsOn)
  {
    DetachProjector(True);
    DetachAllActors();
  }
}


function Trigger(actor Other,pawn Instigator)
{
  bIsOn = !bIsOn;
  if (bIsOn)
  {
    AttachProjector();
    ReattachAllActors();
  }
  else
  {
    DetachProjector(True);
    DetachAllActors();
  }
}

simulated function DetachAllActors()
{
  local actor A;

  foreach TouchingActors(Class'Actor',A)
  {
    DetachActor(A);
  }
}

simulated function ReattachAllActors()
{
  local actor A;

  foreach TouchingActors(Class'Actor',A)
  {
    AttachActor(A);
  }
}

event Touch(Actor Other)
{
  if (bIsOn)
      AttachActor(Other);
}

event Untouch(Actor Other)
{
  DetachActor(Other);
}

Summary

Here I have outlined some sample classes that allow you to do a few interesting tricks with Projectors. Hopefully this helps your understanding of how to do more dynamic things with them, or gives you some ideas of your own.

Attachment: sort Action: Size: Date: Who: Comment:
DynamicProjector.uc action 650 04 Jan 2002 - 20:56 KungFuTheatreTeam Sample projector class updated
ExpandingProjector.uc action 977 21 Dec 2001 - 21:14 KungFuTheatreTeam Sample projector class
TriggeredProjector.uc action 1154 10 Jan 2002 - 00:01 KungFuTheatreTeam A sample projector class.


ProjectorTricks - r1.8 - 06 Mar 2003 - 16:19 GMT - Copyright © 2001-2003 Epic Games
Unreal Developer Network Content by those crazy Perilith guysSite design and art by 2 design