|
|
|
|
|
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.
|
|
|
|
CollisionTutorial |
|
|
|
|
|
Licensees can log in.
Interested in the Unreal engine? Check out the licensing page.
Questions about UDN itself? Contact the UDN Staff.
|
|
|
|
|
|
|
|
|
Last updated by James Golding (jamesg@epicgames.com) October 22nd 2002
This tutorial is intended for UT2003 (2107) and later versions. It is rather basic at the moment, but will be expanded as time allows!
As well as making your UT2003 level look amazing, it is worth spending some time on the collision in your level. After this tutorial, take a look at some of the UT2003 maps and see how the methods described here have been used.
Collision with the level BSP and terrain should work fine without much tweaking. Collision with static meshes, however, can require some optimisation, simply because of the large number of triangles involved. The main job here is using simpler shapes for collision than for graphics. There are 2 reasons for doing this:
- Faster. With the number of triangles now in a level, using just the graphics triangles for collision can get really slow.
- Smoother. It can be really annoying to get 'snagged' on some small graphical detail in the middle of a firefight!
There are two main weapons for tweaking collision in your level, the 'collision model' and the 'blocking volume'. Both must be 'closed' meshes.
These are invisible actors which the player will collide against in game. First make the builder brush the correct shape, then press the 'Volume' button in the editor and select 'BlockingVolume' from the list. These can also be useful for preventing players getting to certain areas of the level eg. over walls.
These are stored as part of a static mesh, in the .usx package. They are 'instanced' in the same way as static mesh graphics, so are more effecient memory-wise than blocking volumes. Note, in the static mesh browser you can change a few properties of how the collision model is used:
UseSimpleBoxCollision | Defaults to True. The collision model (if present) will be used for 'non-zero extent' line checks. This includes things like player movement, but not weapon fire. |
UseSimpleLineCollision | Defaults to False. The collision model (if present) will be used for 'zero extent' line checks. This includes most weapon fire, corona traces etc. |
UseSimpleKarmaCollision | Defaults for True. If a collision model is present it will be turned into a set of convex hulls and used for karma collision. If false, karma will collide with the graphics triangles. Note: Only use this option if the graphics triangles are fairly large. See the 'Collision For Karma' section below for more details. |
Note: With the default settings, Karma things (such as ragdolls) will pass through a static mesh unless it has a collision model.
There are several ways to create a collision model for a static mesh. After adding a collision model to a static mesh you will need to save the .usx.
Place the static mesh that you want add a collision model to into a level. Then place the builder brush around it in the shape you want the collision model to be. Keep it as simple as possible! Then select the static mesh, right click and choose 'Save Brush As Collision'. This will take into account any scaling you may have applied to the static mesh.
For simple collision models there is a 'K-DOP' fitting tool. K-DOP stands 'K discrete oriented polytope' but that doesn't really matter :) Basically it takes 'k' axis-aligned planes and pushes them as close to the mesh as it can. The resulting shape is used as a collision model. In the editor k can be:
6 | Axis-aligned box. |
10 | Box with 4 edges bevelled - you can choose X, Y or Z aligned edges. |
18 | Box with all edges bevelled. |
26 | Box with all edges and corners bevelled. |
See below for an example. This util is quite handy for .usx's full of pipes, pillars and railings. Note that a k-dop is not a different type of collision model - it is simply a utility for generating one.
ASE Import
If you are using 3DS Max you and exporting/importing .ASE files into UnrealEd, you can create your collision model in MAX. Create the the collision model as a seperate object, but make sure the name start 'MCDCX_', for example MCDCX_collision (this is case sensitive). Then export both the graphics and collision mesh in the same .ASE. When you import the .ASE into UnrealEd it should find the collision mesh, remove it from the graphic, and turn it into the collision model.
The way that Karma works is to generate 'contact points' each frame for where things are touching. This is a more complicated process than performing a line check, so it is important to keep the geometry that karma objects (such as a ragdoll) collide with as simple as possible, both for speed and behaviour. For example, a lot of small triangles can lead to Karma objects getting 'snagged', and will take a long time to process.
First, for an actor to block karma actors, it must have the 'bBlockKarma' flag set to true. This is the default for static meshes and blocking volumes.
If 'UseSimpleKarmaCollision' is true, Karma will take the collision model and turn it into a set of convex hull primitives for contact generation. If you choose 'Show Karma Primitives' from the 'View' menu, it will show you each hull that was generated in a different colour, as well as giving you an overall count (indicated in the shot below). You ideally want to keep that count below 10, certainly under 100.
Karma actors collide against BSP and terrain per-triangle. For this reason, you should make sure your BSP and terrain do not have very small triangles in them. For small details, use a blocking volume/collision model.
There are several console commands you can use in-game for reviewing how collision is set up - here are a few. Typing them toggles them on and off.
- 'show collision' This will draw all collision models and blocking volumes in use in the level.
- 'kdraw triangles' This is only for Karma collision, but shows the raw triangles being fed to Karma for contact generation. It allows you to check the size and quantity of triangles you are getting.
- 'stat game' This shows you various useful stats on how long different types of collision are taking.
|
|