Collision groups

From Valve Developer Community
Jump to: navigation, search

Collision groups define what types of collision can collide with each other. For example, an entity using COLLISION_GROUP_DEBRIS will only collide with the world and not any dynamic entities.

When the game tests a pair collision groups, the lower collision group is always first in the checks. All collision groups can touch triggers.

List

These are defined in public/const.h:

Blank image.pngTodo: List collision groups and interactions from Half-Life 2 and Day of Defeat: Source
Name Value Solid to players Solid to bullets Solid to projectiles Solid to physics Solid to world Description
COLLISION_GROUP_NONE
0
Yes Yes Yes Yes Yes Default collision group
COLLISION_GROUP_DEBRIS
1
No No No No Yes Typically used for small objects that shouldn't interfere with gameplay. Will not touch triggers unless the trigger has the Debris spawnflag enabled. Collides with COLLISION_GROUP_PUSHAWAY.
COLLISION_GROUP_DEBRIS_TRIGGER
2
No No No No Yes Despite the name, this is the same as COLLISION_GROUP_DEBRIS, but does not collide with COLLISION_GROUP_PUSHAWAY.
COLLISION_GROUP_INTERACTIVE_DEBRIS
3
No
Half-Life 2: Deathmatch Yes
No No No Yes Same as above, but doesn't collide with other COLLISION_GROUP_INTERACTIVE_DEBRIS. VPhysics props that are asleep will be converted to COLLISION_GROUP_DEBRIS
COLLISION_GROUP_INTERACTIVE
4
Yes Yes Yes Yes Yes Does not collide with debris. Gibs from models not flagged as debris are set to this group. func_door and func_door_rotating use this if set to ignore debris.
COLLISION_GROUP_PLAYER
5
Yes Yes Yes
Team Fortress 2 Depends
Yes Yes Used by players, but NOT for movement collision. Does not collide with COLLISION_GROUP_PASSABLE_DOOR.

Except in Half-Life 2: Deathmatch, this will not collide with COLLISION_GROUP_PUSHAWAY.

In Team Fortress 2, does not collide with grenade, engineer buildings (except teleporters), combat object groups and tank groups.

COLLISION_GROUP_BREAKABLE_GLASS
6
Yes Yes Yes Yes Yes Used by func_breakable_surf. Does not collide with other COLLISION_GROUP_BREAKABLE_GLASS. NPCs ignore these for weapon LOS checks.

In Half-Life 2, crossbow bolts will go through this.

COLLISION_GROUP_VEHICLE
7
Yes Yes Yes Yes Yes Used by driveable vehicles. Always collides against COLLISION_GROUP_VEHICLE_CLIP
COLLISION_GROUP_PLAYER_MOVEMENT
8
Yes
Team Fortress 2 Depends
Yes Yes
Team Fortress 2 No
Yes Yes Used by player movement collision tests.

Half-Life 2 Behaves identically to COLLISION_GROUP_PLAYER. Except in Half-Life 2: Deathmatch, this will not collide with COLLISION_GROUP_PUSHAWAY.

In Team Fortress 2, will not collide with projectile, rocket, grenade, combat object and tank groups. Engineer buildings (except teleporters), players (if tf_avoidteammates is 1), bot_npc_archer, bot_npc_decoy, func_croc, func_forcefield, func_respawnroom, func_respawnroomvisualizer, tf_target_dummy will check for team-specific contents (usually the entity's team number decide these) to consider collision. passtime_ball will not collide with this, but _ballplayertoucher (spawned by the ball) will.

COLLISION_GROUP_NPC
9
Yes Yes Yes Yes Yes Used by NPCs. Always collides with COLLISION_GROUP_DOOR_BLOCKER
COLLISION_GROUP_IN_VEHICLE
10
No No No No No Set on players/NPCs which enter a vehicle.
COLLISION_GROUP_WEAPON
11
Yes Yes Yes
Team Fortress 2 Depends
Yes Yes Used by weapons, including when dropped.

In Team Fortress 2, does not collide with rockets.

COLLISION_GROUP_VEHICLE_CLIP
12
No No No No No Used by func_vehicleclip. Ony collides with COLLISION_GROUP_VEHICLE.
COLLISION_GROUP_PROJECTILE
13
Yes
Team Fortress 2 No
Yes No
Team Fortress 2 Depends
Yes Yes Set on projectiles. Does not collide with other projectiles.

In Team Fortress 2, rockets and grenades have their own collision groups. This will not collide with rockets, however it does collide with grenades!

COLLISION_GROUP_DOOR_BLOCKER
14
No No No
Team Fortress 2 Depends
No No Used by prop_door_rotating (creates a entity_blocker entity). Only supposed to collide with COLLISION_GROUP_NPC.

In Team Fortress 2, also collides with rockets, grenades and certain projectiles.

Blank image.pngTodo: Investigate the projectile behavior more
COLLISION_GROUP_PASSABLE_DOOR
15
No Yes Yes Yes Yes Used by func_door and func_door_rotating when the non-solid spawnflag is set.
COLLISION_GROUP_DISSOLVING
16
No Yes No Yes Yes Set on entities dissolved with env_entity_dissolver. Only collides with COLLISION_GROUP_NONE.
COLLISION_GROUP_PUSHAWAY
17
No
Half-Life 2: Deathmatch Yes
Yes Yes Yes Yes Set by func_physbox_multiplayer. Also set by prop_physics_multiplayer on spawn and when awakened, if sv_turbophysics is enabled. Collides with COLLISION_GROUP_DEBRIS. Used to push away props from the player in Counter-Strike: Source and Day of Defeat: Source.
COLLISION_GROUP_NPC_ACTOR
18
Yes
Half-Life 2 No
Yes Yes Yes Yes Set on NPCs when they are potentially stuck in a player. Behaves identically to COLLISION_GROUP_NPC if not testing against COLLISION_GROUP_PLAYER.
COLLISION_GROUP_NPC_SCRIPTED
19
Yes Yes Yes Yes Yes Set on NPCs playing out a scripted_sequence, if NPC collisions are set to be disabled.

In Half-Life 2, does not collide with other COLLISION_GROUP_NPC_SCRIPTED

Extended collision groups in Team Fortress 2 Team Fortress 2 only:

Name Value Solid to players Solid to hitscan Solid to projectiles Solid to physics Solid to world Description
TFCOLLISION_GROUP_GRENADES
20
No Yes N/A
Depends
Yes Yes Set by grenade projectiles. Does not collide with other TFCOLLISIONGROUP_GRENADES and rockets.
TFCOLLISION_GROUP_OBJECT
21
N/A
Depends
Yes Yes Yes Yes Set by Engineer buildings except teleporters. Uses team-specific contents on players.
TFCOLLISION_GROUP_OBJECT_SOLIDTOPLAYERMOVEMENT
22
Yes Yes Yes Yes Yes Set on teleporters.
TFCOLLISION_GROUP_COMBATOBJECT
23
No Yes Yes Yes Yes Set by placed sappers and the medigun shield (entity_medigun_shield).
TFCOLLISION_GROUP_ROCKETS
24
No Yes No Yes Yes Set by rocket projectiles. Collides with COLLISION_GROUP_PLAYER but not player movement. Does not collide with weapons or any projectiles except rockets. Collides with medigun shields.
TFCOLLISION_GROUP_RESPAWNROOMS
25
Yes No No No No Used by func_respawnroom and func_respawnroomvisualizer.
TFCOLLISION_GROUP_PUMPKIN_BOMB
26
No Yes Yes Yes Yes Set by team-assigned tf_pumpkin_bombs.
TFCOLLISION_GROUP_ROCKET_BUT_NOT_WITH_OTHER_ROCKETS
27
No Yes No Yes Yes Set by arrows and the Short Circuit's secondary attack (tf_projectile_mechanicalarmorb). Same as TFCOLLISION_GROUP_ROCKETS but doesn't collide with other rockets.

Table