By default, all Volumes in UnrealEd are static - this means they can't be moved in-game. Every volume has a hidden property bStatic, which you can't change through the properties window. This tutorial shows you how to make a few simple changes to create a moving volume. Please note: you can make .uc files with a plain text editor like notepad or WotGreal, but I'm using UnrealEd to create a new class and export .uc files in this tutorial because it's easier for non-coders.
First we need to make a subclass of an existing volume and change the bStatic property to false.
A window like the one below should appear with some ready-written basic code.
//=========================================================================== // MovingPhysicsVolume. //=========================================================================== class MovingPhysicsVolume extends PhysicsVolume placeable;
We can't change the bStatic property through UnrealEd, so you need to export the script and edit it in a text editor.
//=========================================================================== // MovingPhysicsVolume. //=========================================================================== class MovingPhysicsVolume extends PhysicsVolume placeable; defaultproperties { }
Remove the line which says placeable; - we only want the volume to be added from the Volume button, not from the actor browser.
Now you can add the bStatic property:
//=========================================================================== // MovingPhysicsVolume. //=========================================================================== class MovingPhysicsVolume extends PhysicsVolume; defaultproperties { bStatic=false; }
Don't forget to close UnrealEd and save the .uc file.Next you need to compile the package into a .u file so you can import it back into the map with the new properties. Since it's already called "myLevel", it should be automatically embedded in the map file when you import it.
Open UnrealEd again and go to the actor browser.
To attach the new volume to a mover, set the Volumes Movement > Attach tag to the mover's Event > Tag. There is a bug where velocity and gravity on moving PhysicsVolumes (and WaterVolumes) will only take effect if the player is already touching it. To solve this, place the volume so the top is a few units above the floor the player is standing on so they are already touching the volume before it moves. Don't add too many moving volumes to a map, especially on constantly looping movers as it can cause a drop in fps and lag online.
I hope you found this tutorial easy to follow! If you're still stuck, take a look at this example map [movingvolume.zip]