Collada plugin for After Effects

More info here
Unreal Ambient Creature Tutorial - UDK notes
This is a collection of notes for using the Ambient Creature project from the Mastering Unreal Script Book Chapter 6 in the Unreal Development Kit(UDK). The original text was made for the Unreal Tournament 3(UT3) editor. The chapter for the book can be found on the UDN website here. The "DM-CH_06_FishPool.ut3" map file uses static meshes from UT3 that are not available in the UDK, so I threw together a map made with UDK static meshes. It's not pretty, but it works. The fish are in an invisible water volume so you can swim with them. My original version of the map had a water surface made from one of the included UDK materials, but the reflections made it difficult to see the fish so I removed it. The major obstacle to using the tutorial for UDK is that the "DesiredRotation" changed between UT3 and UDK and was moved from the Actor to the Pawn class.

This process was used on the UDK October 2010 beta release installed to drive C.

Note that the script files here haven't been cleaned up. There are a lot of extra comments and I commented out lines instead of cutting and pasting when the tutorial called for it.


Download links:

Prepare the UDK folders and ini files:

Create the folder for the uc class files here - C:\UDK\UDK-2010-10\Development\Src\MasteringUnrealScript\Classes

Copy Chapter_06_Functions.upk to the preexisting folder - C:\UDK\UDK-2010-10\UDKGame\Content\TestPackages\MasteringUnreal

Copy the sample chapter 6 map to C:\UDK\UDK-2010-10\UDKGame\Content\Maps and rename the extension from ut3 to udk or better yet use the map supplied on this page.

The following steps are based on a forum post on the UDN here.

  1. The first step in the compiling process is to add the MasteringUnrealScript package to the list of ModPackages in the UDKEditor.ini file. Without performing this step, the compiler will not know to look for our new scripts and they will not be compiled.

    Navigate to the following directory:

    C:\UDK\UDK-2010-10\UDKGame\Config
  2. Locate the DefaultEditorUDK.ini file and open it in Notepad or some other text editor so that it can be edited. It is usually write protected so change it's permissions. In notepad++ you can do menu item - Edit - Clear Read Only flag
  3. Find the section of the .ini file with the [ModPackages] heading. A simple way to find this section is to search the file for ModPackages.
  4. change ModPackagesInPath=..\..\UDKGame\Src to ModPackagesInPath=..\..\Development\Src
  5. Place the cursor at the end of the following line and press Enter.

    ModOutputDir=..\UDKGame\Unpublished\CookedPC\Script
  6. Add this line to add the MasteringUnrealScript package to the list of packages to be compiled.

    ModPackages=MasteringUnrealScript
  7. Save the DefaultEditorUDK.ini file and close it.
  8. Open DefaultEngineUDK.ini in the same folder and under [UnrealEd.EditorEngine]

    change the line ;ModEditPackages=MyMod to

    ModEditPackages=MasteringUnrealScript

    Save and close the .ini file.
  9. Delete all the UDK*.ini files which will be replaced by copies of the corresponding Default*ini files at compile time.

I'm using ConTEXT so I set it up for hard tabs, tab space=4 and smart tabs off for a better experience.

I added -log to the shortcut so i could see the log as it is written: D:\UDK\UDK-2010-10\Binaries\UDKLift.exe editor -log. This way I can use a command like `log("This will add a line to the log output"); in the script to debug it.

Corrections and changes to the web page text and uc script code:

A major obstacle to doing the mastering Unreal Script Chapter 6 tutorial is that desired rotation has changed since UT3.
From the Actor Class:

/**
* PLEASE NOTE DesiredRotation is removed
* This DesiredRotation is moved to Pawn to remove redundant variables usage. (i.e. between Pawn and Controller)
* Pawn now handles all DesiredRotation and it is only one place.
* All Actor's DesiredRotation won't work anymore - Use RotationRate to control Actor's rotation
**/


Tutorial 6.1 step 2. Change class AmbientCreature extends Actor; to class AmbientCreature extends Pawn;

Tutorial 6.2 step 6. Created an extra class variable line to be used in place of the DesiredRotation from UT3.

var Rotator MyDesiredRotation;

Tutorial 6.4 step 3. add a line bCollideActors=False so fish don't collide with each other

Tutorial 6.4 step 4. change Physics=PHYS_Projectile to Physics=PHYS_Flying and add a line WalkingPhysics=PHYS_None. I don't know if the WalkingPhysics part is needed or not and PHYS_Swimming might work in place of Flying but it may also drown the fish. I haven't tested so it's unkown to me.

Tutorial 6.5 step 7. Change DesiredRotation to MyDesiredRotation

Tutorial 6.5 step 5 and 6. Change DesiredRotation to MyDesiredRotation

Tutorial 6.9 step 3 - copy from web page gave mystery error, error went away after manually typing the line

The next set of changes are in the form of a tutorial between Tutorial 6.9 and Tutorial 6.10

Tutorial 6.9.5 - New tutorial using the Pawn class SetDesiredRotation function

Reference information from the Pawn class:


/** DesiredRotation related function **/
/** SetDesiredRotation function
* @param TargetDesiredRotation: DesiredRotation you want
* @param InLockDesiredRotation: I'd like to lock up DesiredRotation, please nobody else can touch it until I say it's done
* @param InUnlockWhenReached: When you lock, set this to TRUE if you want it to be auto Unlock when reached desired rotation
* @param InterpolationTime: Give interpolation time to get to the desired rotation - Ignore default RotationRate, but use this to get there
* @return TRUE if properly set, otherwise, return FALSE
**/
//native final function bool SetDesiredRotation(Rotator TargetDesiredRotation, bool InLockDesiredRotation=FALSE, bool InUnlockWhenReached=FALSE, FLOAT InterpolationTime=-1.f, bool bResetRotationRate=TRUE);



1. New function variables for the SetDesiredRotation function. InLockDesiredRotation, InUnlockWhenReached and InterpolationTime are used in the pawn's SetDesiredRotation function.
cosang and angbet are used to store the cosine of the angle and the angle between the current rotation and the new desired rotation.


local bool InLockDesiredRotation;
local bool InUnlockWhenReached;
local FLOAT InterpolationTime;

local float cosang, angbet;


The next set of steps are added before the SetTimer call

2. Get the angle between the old and new directions of the ambient creature. First use the dot function to find the cosine of the angle between the two directions, then use the acos function to get the actual angle in radians. The DesiredRotation is used as the old direction. The Rotation variable might be better here.
Finally, convert the angle from radians to unreal rotation units removing any negative value with the abs function.
1 PI radian == 32768 unreal rotation units == 180 degrees

cosang = Normal(Vector(DesiredRotation)) dot Normal(DestNode.Location - Location);

angbet = Acos(cosang);

angbet = abs((32762/PI)*Acos(cosang));


3. Set the rotation time interval using the angle and the yaw rotation rate. Maybe some sort of average for yaw, roll and pitch rotation rates could be used here.

InterpolationTime=angbet/RotationRate.Yaw;

4. Locking is needed for the ambient creature code to maintain control of the desired rotation, otherwise the fish will rotate back to their original orientations after achieving the desired rotation.
Start by unlocking the DesiredRotation from the previous call to the function. False==unlock

LockDesiredRotation(False);

5. Setup lock arguments for the desired rotation function. Set so that the call locks the desired rotation and does not unlock it when it has reached it's target orientation.

InLockDesiredRotation=TRUE; get ready to lock on the next call
InUnlockWhenReached=FALSE; don't unlock when reach the target rotation


6. Now set the desired rotation. SetTimer will still be the last line of this function. This line goes just before it.

SetDesiredRotation(MyDesiredRotation, InLockDesiredRotation, InUnlockWhenReached, InterpolationTime );

<<<< End of Tutorial>>>>

Tutorial 6.11 step 4. - made min and max bigger so I could see from a distance what the fish were doing more easily.

MinSize=0.1
MaxSize=0.25


Tutorial 6.12 step 6. - changed Super(Actor).PostBeginPlay(); to Super(Pawn).PostBeginPlay(); from Pawn instead of Actor class

Tutorial 6.14 step 7. - bad quotes on the web page change ClearTimer(‘SetRandDest’); to ClearTimer('SetRandDest');

And that's it. It should be possible to follow the original tutorial using the information and downloads on this page.