|
Understanding and Using Collision in Your Map
Created August 2004
Updated 09-20-04
Collision is what happens when two things collide with each other. This usually involves players (including AI operatives and terrorists), static meshes, and bullets (including grenades). I am going to discuss different examples of when to allow and not allow two things to collide with each other.
Collision Properties
Let's take a look at the Collision properties

bAutoAligntoTerrain If this is set to True, the actor will automatically align to the terrain. While this does work, you don't have as much choice in fine tuning the placement of an actor (usually a static mesh). I would leave this to false and align the actor manually.
bBlockActors If this is set to True (must have bCollideActors=True too), the item will collide with bullets and grenades.
bBlockKarma If this is set to True (must have bCollideActors=True too), the item will block a player while the player is dying. This assumes the item has Karma support.
bBlockPlayer This is suppose to block a player from walking through the item if set to True (must have bCollideActors=True too). I have found that it doesn't matter what bBlockPlayer is set to. If you have bCollideActors set to True, it will automatically block players.
bCollideActors If set to true, it will block players from walking through the item. It will also allow bBlockKarma and bBlockActors to work if they are also set to True.
bCollideWorld From what I understand, this field is not used in the RVS version of the editor.
bUseCyclinderCollision This field is not used in the RVS version of the editor.
Collision Height This field is not used in the RVS version of the editor.
Collision Radius This field is not used in the RVS version of the editor.
m_bBulletsGoThrough If this is set to True, it will tell an AI (terrorist and operatives) that they can shoot through an item. It doesn't allow the bullets to actually go through. This is controlled by the bBlockActors field.
m_bPawnGoThrough If this is set to True and bCollideActors is set to True, it will allow a player (including terrorist and operatives) to walk through an item.
m_bSeeThrough If this is set to True, it will tell an AI (terrorist and operative) that they can see through the item.
Player & Bullets vs. Static Mesh (The Static Mesh wins)
Most of the time a static mesh is set up, by default, to collide with a player and bullets. When the player runs into a car, for example, the car blocks the player. If the player shoots the same car, the bullets will hit the car, usually with visual effects. This is what should happen in a realistic game. To make sure this happens, set bCollideActors and bBlockActors to True.
Player vs. Static Mesh (The Player wins)
Other times you might want a player not to be blocked by a static mesh for the sake of game play. A window frame is a good example when a player should not collide with a static mesh. This is beneficial so a player won't get caught on something that is barely sticking out of a wall. How often do you get caught on a window or door frame in your daily activities? Not that often I would presume. But the game will allow a sign made from a sheet (which has no depth) that is 1 unit away from a wall to block a player. But you still want the bullets to hit the window frame for cool effects. To make sure this happens, set bCollideActors, bBlockActors, and m_bPawnGoThrough to True.
Bullets vs. Static Mesh (The Bullets wins)
There will be some times when you want a static mesh to block players, but allow bullets to go through it. The best example I can think of is a chain link fence. Bullets should be able to go through a fence. If you do allow them to go through, you have to allow grenades to go through the same fence. But a fence should block a player. To make sure this happens, set bCollideActors to True and bBlockActors to False.
Other Techniques to Block Players
Blocking Volumes
Sometimes you will want to block a player from going some where in the map. This can include stopping a player from climbing up some static mesh boxes that are not intended to be climbed on or crawl under a table that leads to a part of them map not intended to be used. There will be times when a player can get to a place because a static mesh is sticking out enough where the player can walk up on. This can allow the player to get to places where they really shouldn't go. There are several examples in stock maps, this is normally referred to as "glitching". To make certain a player can't get to a place in this circumstance, you can use a blocking volume. Click here to learn more about what a blocking volume is. Set the blocking volume's collision properties as follows, bBlockActors to False and bCollideActors, m_bBulletsGoThrough, and m_bSeeThrough to True.
Blocking Volumes can also be used to simplify the collision process. Normally, when a player collides with a static mesh, it is done on a per poly basis. This means that all of the triangles that make up that static mesh can touch a player. With certain static meshes, this can easily snag a player and block them, similar to the window example mentioned earlier. You can also have a bunch of static meshes arranged to create a lot of opportunities for this to happen, such as a table and chairs. You could create a single blocking volume around the chair and tables and allow that to block the player. If you choose this option, create a simple shape that surrounds the static mesh. You can use the clipping tool to make sure the blocking volume surround the items, but doesn't protrude to much.
Custom Static Meshes Built in the Editor
If you have built a static mesh in the editor, the static mesh browser allows you to create a built in "blocking volume", called a Simplified Collision. To create one, select the static mesh in your static mesh package. The browser seems to be finicky when creating one, I found this to work. First, select the Edit menu, then select Create Karma collision from bounding box. Next, select the Edit menu, then select Create Simplified Collision. Now, select the Edit menu, then select Remove Karma Collision. If you try to create the Simplified Collision box first, it doesn't seem to work.
To view this Simplified Collision, select the View menu, then select Show Simplified Collision. The static mesh will disappear and be replaced with a wire frame box made of white lines. If you look closely, you will notice the triangles that are created on each side of the box (see below). This is what the player will collide with, nice and simple collision. This will be useful if you created a complex shaped item with edges and pieces that a player can easily get caught on. If you built a wall or a column, using this won't help much.

To view which items have this enabled in the 3D editor, you must have this view activated in the static mesh browser. This will automatically give you the same view in the editor. Remember, every time you make a change to your static mesh package, you must save the package. In addition, never, ever, ever make changes to other static mesh packages (stock or custom created by another modder). Doing so will give you a version mismatch when ever you play the same map with other people.
Summary
This should give you a solid understanding of how collision works. It will be up to you to decide when you should enable or disable it for particular static meshes or use a blocking volume to help game play. If you want more information on Karma collision, click here to read another tutorial.
All stairs should have a collision hull on them. This will provide a smooth surface that the player can walk on while going up and down stairs. Click here to learn how to make one.
Written by cwv_Odedge
|