Overview

As graphical detail has increased, it is important to ensure that collision within the game remains simple. This is because of two reasons; it is much faster to calculate collision against a few polygons and it is a much smoother experience for the player as then the player does not get snagged on a small piece geometry. Collision response is split up into to distinct parts; Unreal Collision and PhysX. This document focuses on Unreal Collision, click here to read more about PhysX. For more technical information about collision, please see the Collision Technical Guide page.

Creating Skeletal mesh collision hulls

Please see PhAT User Guide on how to create collision hulls used by Skeletal Meshes.

Creating static mesh collision hulls

Creating a collision hull using the builder brush

Place the static mesh that you want to add a collision hull to into a level. Then place the builder brush around it in the shape you want the collision hull to be. Keep it as simple as possible!

Then select the static mesh, right click and choose Set Collision From Builder Brush from the context menu. This will take into account any scaling you may have applied to the static mesh.

It is very important to note that this collision will be added to all instances of the static mesh you have selected. To see the effect of saving the brush as collision you will have to save the package that contains the static mesh.

Creating a collision hull using the K-DOP tool

K-DOP is a tool in the Static Mesh Editor for generating simple collision hulls. K-DOP is a type of bounding volume, which stands for K discrete oriented polytope (where K is the number of axis aligned planes). 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 hull. In the Static Mesh Editor K can be:

Creating a collision hull using your 3D Content Creation Package

Volumes

These are invisible BSP which can collide against actors in game. The example below will show you how to make a blocking volumes. Volumes can be both blocking collision and non blocking collision.

How to create a blocking volume

First make the builder brush the correct shape.

Right click on the Volume button in Unreal Editor and select BlockingVolume from the list.

These are generally used to block actors from reaching certain areas of the level.

Examples

Here are some examples of how to set various collision flags for common collision scenarios. The goal is to have the right combination of collision checks and flags for physics simulation.

Player Movement and Weapon Fire

For proper player movement, specifically, having a collision cylinder to be used for Pawn movement and collision with other Pawns, while using the kinematic bones for accurate collision detection (e.g. when tracing rays for shots), consider the following:

Unreal physics (eg. PHYS_Walking) will sweep out the axis aligned bounding box of just the CollisionComponent. Using a SkeletalMeshComponent as the CollisionComponent when using PHYS_Walking is a bad idea, because it changes shape a lot as the character animates.

A line check will check against all PrimitiveComponents attached to an Actor, if they have CollideActors and BlockZeroExtent set set to true.

You do not need to have a PhysicsAssetInstance and kinematic bones to do line checks against bones. Simply having a PhysicsAsset assigned and having CollideActors and BlockZeroExtent set to true should result in you getting line check results (assuming the component is attached).

RBChannel/RBCollideWithChannel only affects physics engine collision. If your player is using PHYS_Walking, it will have no effect.

Basically, your Pawn wants a CylinderComponent and a SkeletalMeshComponent. The CollisionComponent reference should be assigned to the CylinderComponent, and the SkeletalMeshComponent should set CollideActors and BlockZeroExtent to true, and your CylinderComponent should probably set BlockZeroExtent to false, to stop it from interfering with weapon traces.

Reviewing Collision In-Game

There are several console commands you can use in-game for reviewing the collision setup. 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.

show zeroextent - Show collision in the level as if you were a zero extent trace. Invisible objects have no collision.

show nonzeroextent - Show collision in the level as if you were a non zero extent trace.

show rigidbody - Show collision in the level as if you were a rigid body (note, this does not show the effect of RBCC filter groups, only BlockRigidBody and UseSimpleRigidBodyCollision).

nxvis collision - This shows you the PhysX collision information for the level, so you can see what rigid bodies are colliding with.

stat game - This shows you various useful stats on how long different types of collision are taking.