Collision Basics
Collision in game engines is divided into two general steps: collision detection and collision resolution.
Collision Detection
This step involves finding/reporting when two objects are intersecting. This is the fundamental aspect of collision detection. Look at the following general illustration of what it means for two objects to not be intersecting and to be intersecting:
Not Intersecting:
Intersecting:
Collision Resolution
Once two objects have been found to be intersecting, we can do two things about:
- Nothing. Let them remain intersecting and either do nothing or report the intersection.
- Push them apart.
Depending on the requirements of the situation, we opt to do different things.
Allow Intersection
When we allow the intersection, we simply allow the objects to continue overlapping or to pass through each other on their own time. The physics engine does not act to push them apart.
Push Apart
In this situation, the physics engine finds a possible push vector and applies a force to cause the objects to cease intersecting. Such a vector may look as follows:
UDK
In the UDK, the math is done behind the scenes. We set the relevant properties on Actors and the UDK does the heavy lifting.
To use the UDK's collision system, an Actor must:
- Set its properties accordingly
- Must have one or more collision primitive components placed upon it
Properties
- var bool bCollideActors;
- Whether this actor intersects other actors
- var bool bCollideWorld;
- Whether this actor intersects with world geometry such as BSP and editor-placed static meshes
- var bool bBlockActors;
- Whether this actor prevents other actors from passing through it
Engine Events
A number of engine events exist to notify an actor of when it collides or blocks other actors. They are:
- Touch
event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal);
- Bump
event Bump(Actor Other, PrimitiveComponent OtherComp, Vector HitNormal);
For other events, see the collision technical guide posted at the bottom of this page.
Typical Combinations
Let's look at some common combinations:
bCollideActors | bCollideWorld | bBlockActors | Result |
---|---|---|---|
false | false | false | No notifications are sent, other actors allowed to pass through this actor |
true | true | false | Touch called when actor intersects with other actors or world, other actors allowed to pass through this actor |
false | false | true | Other actors not allowed to pass through this actor, Bump called when actor contacts other actors |
true | true | true | Other actors not allowed to pass through this actor, Bump called when actor contacts other actors, note that Touch is not called with this combination |
Collision Primitives
See:
More Information
For more information, see the UDN collision reference pages: