Collision groups: Difference between revisions
mNo edit summary |
(Portal 2 and Gmod collision groups, I didn't test Gmod yet) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Collision groups define what types of collision can collide with each other. For example, an entity using <code>COLLISION_GROUP_DEBRIS</code> 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 <code>public/const.h</code>: | |||
{{todo|List collision groups and interactions from {{hl2}} and {{dods}}}} | |||
< | {| class="standard-table" | ||
|- style="z-index:1; position:sticky; top:0" | |||
COLLISION_GROUP_DEBRIS | ! width="100px" | Name | ||
COLLISION_GROUP_DEBRIS_TRIGGER | ! width="50px" | Value | ||
COLLISION_GROUP_INTERACTIVE_DEBRIS | ! width="75px" | Solid to players | ||
COLLISION_GROUP_INTERACTIVE | ! width="75px" | Solid to bullets | ||
! width="75px" | Solid to projectiles | |||
! width="75px" | Solid to physics | |||
! width="75px" | Solid to world | |||
! Description | |||
|- id="none" | |||
| <center>COLLISION_GROUP_NONE</center> | |||
| <center>0</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
COLLISION_GROUP_PASSABLE_DOOR | | {{Yes}} | ||
| Default collision group | |||
COLLISION_GROUP_PUSHAWAY | |- id="debris" | ||
| <center>COLLISION_GROUP_DEBRIS</center> | |||
| <center>1</center> | |||
| {{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 <code>COLLISION_GROUP_PUSHAWAY</code>. | |||
|- id="trigger" | |||
| <center>COLLISION_GROUP_DEBRIS_TRIGGER</center> | |||
| <center>2</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{Yes}} | |||
| Despite the name, this is the same as <code>COLLISION_GROUP_DEBRIS</code>, but does not collide with <code>COLLISION_GROUP_PUSHAWAY</code>. | |||
|- id="debris" | |||
| <center>COLLISION_GROUP_INTERACTIVE_DEBRIS</center> | |||
| <center>3</center> | |||
| {{No|style=background:#FFFF00}}<br>{{hl2dm}} Yes | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{Yes}} | |||
| Same as above, but doesn't collide with other <code>COLLISION_GROUP_INTERACTIVE_DEBRIS</code>. [[VPhysics]] props that are asleep will be converted to <code>COLLISION_GROUP_DEBRIS</code> | |||
|- id="interactive" | |||
| <center>COLLISION_GROUP_INTERACTIVE</center> | |||
| <center>4</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Does not collide with debris. [[$collisiontext|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. | |||
|- id="player" | |||
| <center>COLLISION_GROUP_PLAYER</center> | |||
| <center>5</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes|style=background:#FFFF00}}<br>{{tf2}} Depends | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by players, but NOT for movement collision. Does not collide with <code>COLLISION_GROUP_PASSABLE_DOOR</code>. | |||
Except in {{hl2dm}}, this will not collide with <code>COLLISION_GROUP_PUSHAWAY</code>. | |||
In {{tf2}}, does not collide with grenade, engineer buildings (except teleporters), combat object groups and tank groups. | |||
|- id="glass" | |||
| <center>COLLISION_GROUP_BREAKABLE_GLASS</center> | |||
| <center>6</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by [[func_breakable_surf]]. Does not collide with other <code>COLLISION_GROUP_BREAKABLE_GLASS</code>. NPCs ignore these for weapon [[LOS]] checks. | |||
In {{hl2}}, crossbow bolts will go through this. | |||
|- id="vehicle" | |||
| <center>COLLISION_GROUP_VEHICLE</center> | |||
| <center>7</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by [[Half-Life_2_Vehicles|driveable vehicles]]. Always collides against <code>COLLISION_GROUP_VEHICLE_CLIP</code> | |||
|- id="movement" | |||
| <center>COLLISION_GROUP_PLAYER_MOVEMENT</center> | |||
| <center>8</center> | |||
| {{Yes|style=background:#FFFF00}}<br>{{tf2}} Depends | |||
| {{Yes}} | |||
| {{Yes|style=background:#FFFF00}}<br>{{tf2}} No | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by player movement collision tests. | |||
{{hl2}} Behaves identically to <code>COLLISION_GROUP_PLAYER</code>. | |||
Except in {{hl2dm}}, this will not collide with <code>COLLISION_GROUP_PUSHAWAY</code>. | |||
// | In {{tf2}}, will not collide with projectile, rocket, grenade, combat object and tank groups. Engineer buildings (except teleporters), players (if <code>tf_avoidteammates</code> 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|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. | ||
|- id="npc" | |||
| <center>COLLISION_GROUP_NPC</center> | |||
| <center>9</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by NPCs. Always collides with <code>COLLISION_GROUP_DOOR_BLOCKER</code> | |||
|- id="vehicle" | |||
| <center>COLLISION_GROUP_IN_VEHICLE</center> | |||
| <center>10</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| Set on players/NPCs which enter a vehicle. | |||
|- id="weapon" | |||
| <center>COLLISION_GROUP_WEAPON</center> | |||
| <center>11</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes|style=background:#FFFF00}}<br>{{tf2}} Depends | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by weapons, including when dropped. | |||
In {{tf2}}, does not collide with rockets. | |||
|- id="clip" | |||
| <center>COLLISION_GROUP_VEHICLE_CLIP</center> | |||
| <center>12</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| Used by [[func_vehicleclip]]. Ony collides with <code>COLLISION_GROUP_VEHICLE</code>. | |||
|- id="projectile" | |||
| <center>COLLISION_GROUP_PROJECTILE</center> | |||
| <center>13</center> | |||
| {{Yes|style=background:#FFFF00}}<br>{{tf2}} No | |||
| {{Yes}} | |||
| {{No|style=background:#FFFF00}}<br>{{tf2}} Depends | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set on projectiles. Does not collide with other projectiles. | |||
In {{tf2}}, rockets and grenades have their own collision groups. This will not collide with rockets, however it does collide with grenades! | |||
|- id="blocker" | |||
| <center>COLLISION_GROUP_DOOR_BLOCKER</center> | |||
| <center>14</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No|style=background:#FFFF00}}<br>{{tf2}} Depends | |||
| {{No}} | |||
| {{No}} | |||
| Used by [[prop_door_rotating]] (creates a [[entity_blocker]] entity). Only supposed to collide with <code>COLLISION_GROUP_NPC</code>. | |||
In {{tf2}}, also collides with rockets, grenades and certain projectiles. | |||
{{todo|Investigate the projectile behavior more}} | |||
|- id="door" | |||
| <center>COLLISION_GROUP_PASSABLE_DOOR</center> | |||
| <center>15</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Used by [[func_door]] and [[func_door_rotating]] when the non-solid spawnflag is set. | |||
|- id="dissolving" | |||
| <center>COLLISION_GROUP_DISSOLVING</center> | |||
| <center>16</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set on entities dissolved with [[env_entity_dissolver]]. Only collides with <code>COLLISION_GROUP_NONE</code>. | |||
|- id="pushaway" | |||
| <center>COLLISION_GROUP_PUSHAWAY</center> | |||
| <center>17</center> | |||
| {{No|style=background:#FFFF00}}<br>{{hl2dm}} 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 <code>COLLISION_GROUP_DEBRIS</code>. Used to push away props from the player in {{css}} and {{dods}}. | |||
|- id="actor" | |||
| <center>COLLISION_GROUP_NPC_ACTOR</center> | |||
| <center>18</center> | |||
| {{Yes|style=background:#FFFF00}}<br>{{hl2}} No | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set on NPCs when they are potentially stuck in a player. Behaves identically to <code>COLLISION_GROUP_NPC</code> if not testing against <code>COLLISION_GROUP_PLAYER</code>. | |||
|- id="scripted" | |||
| <center>COLLISION_GROUP_NPC_SCRIPTED</center> | |||
| <center>19</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set on NPCs playing out a [[scripted_sequence]], if NPC collisions are set to be disabled. | |||
In {{hl2}}, does not collide with other <code>COLLISION_GROUP_NPC_SCRIPTED</code> | |||
|} | |||
Extended collision groups in {{tf2|2}} only: | |||
{| class="standard-table" | |||
</ | |- style="z-index:1; position:sticky; top:0" | ||
! width="100px" | Name | |||
! width="50px" | Value | |||
! width="75px" | Solid to players | |||
! width="75px" | Solid to hitscan | |||
! width="75px" | Solid to projectiles | |||
! width="75px" | Solid to physics | |||
! width="75px" | Solid to world | |||
! Description | |||
|- id="grenades" | |||
| <center>TFCOLLISION_GROUP_GRENADES</center> | |||
| <center>20</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{N/A}}<br>Depends | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set by grenade projectiles. Does not collide with other <code>TFCOLLISIONGROUP_GRENADES</code> and rockets. | |||
|- id="object" | |||
| <center>TFCOLLISION_GROUP_OBJECT</center> | |||
| <center>21</center> | |||
| {{N/A}}<br>Depends | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set by Engineer buildings except teleporters. Uses team-specific [[$contents|contents]] on players. | |||
|- id="solidtoplayermovement" | |||
| <center>TFCOLLISION_GROUP_OBJECT_SOLIDTOPLAYERMOVEMENT</center> | |||
| <center>22</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set on teleporters. | |||
|- id="combatobject" | |||
| <center>TFCOLLISION_GROUP_COMBATOBJECT</center> | |||
| <center>23</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set by placed sappers and the medigun shield ([[entity_medigun_shield]]). | |||
|- id="rockets" | |||
| <center>TFCOLLISION_GROUP_ROCKETS</center> | |||
| <center>24</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set by rocket projectiles. Collides with <code>COLLISION_GROUP_PLAYER</code> but not player movement. Does not collide with weapons or any projectiles except rockets. Collides with medigun shields. | |||
|- id="respawnrooms" | |||
| <center>TFCOLLISION_GROUP_RESPAWNROOMS</center> | |||
| <center>25</center> | |||
| {{Yes}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| Used by [[func_respawnroom]] and [[func_respawnroomvisualizer]]. | |||
|- id="tank" | |||
| <center>TFCOLLISION_GROUP_PUMPKIN_BOMB</center> | |||
| <center>26</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set by team-assigned [[tf_pumpkin_bomb]]s. | |||
|- id="rockets" | |||
| <center>TFCOLLISION_GROUP_ROCKET_BUT_NOT_WITH_OTHER_ROCKETS</center> | |||
| <center>27</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Set by arrows and the Short Circuit's secondary attack ([[tf_projectile_mechanicalarmorb]]). Same as <code>TFCOLLISION_GROUP_ROCKETS</code> but doesn't collide with other rockets. | |||
|} | |||
Extended collision groups in {{Gmod|2}}: | |||
{| class="standard-table" | |||
|- style="z-index:1; position:sticky; top:0" | |||
! width="100px" | Name | |||
! width="50px" | Value | |||
! width="75px" | Solid to players | |||
! width="75px" | Solid to hitscan | |||
! width="75px" | Solid to projectiles | |||
! width="75px" | Solid to physics | |||
! width="75px" | Solid to world | |||
! Description | |||
|- id="world" | |||
| <center>COLLISION_GROUP_WORLD</center> | |||
| <center>20</center> | |||
| {{N/A|{{todo}} Unknown}} | |||
| {{N/A|{{todo}} Unknown}} | |||
| {{N/A|{{todo}} Unknown}} | |||
| {{N/A|{{todo}} Unknown}} | |||
| {{N/A|{{todo}} Unknown}} | |||
| Doesn't collide with players/props | |||
|} | |||
Extended collision groups in {{P2|2}}: | |||
{| class="standard-table" | |||
|- style="z-index:1; position:sticky; top:0" | |||
! width="100px" | Name | |||
! width="50px" | Value | |||
! width="75px" | Solid to players | |||
! width="75px" | Solid to hitscan | |||
! width="75px" | Solid to projectiles | |||
! width="75px" | Solid to physics | |||
! width="75px" | Solid to world | |||
! Description | |||
|- id="pzclip" | |||
| <center>COLLISION_GROUP_PZ_CLIP</center> | |||
| <center>20</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| | |||
|- id="camerasolid" | |||
| <center>COLLISION_GROUP_CAMERA_SOLID</center> | |||
| <center>21</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| Solid only to the camera's test trace. | |||
|- id="placementsolid" | |||
| <center>COLLISION_GROUP_PLACEMENT_SOLID</center> | |||
| <center>22</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| Solid only to the placement tool's test trace. | |||
|- id="playerheld" | |||
| <center>COLLISION_GROUP_PLAYER_HELD</center> | |||
| <center>23</center> | |||
| {{No}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Held objects that shouldn't collide with players. | |||
|- id="weightedcube" | |||
| <center>COLLISION_GROUP_WEIGHTED_CUBE</center> | |||
| <center>24</center> | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| {{Yes}} | |||
| Cubes need a collision group that acts roughly like COLLISION_GROUP_NONE but doesn't collide with debris or interactive. | |||
|- id="debrisblockprojectile" | |||
| <center>COLLISION_GROUP_DEBRIS_BLOCK_PROJECTILE</center> | |||
| <center>25</center> | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| {{No}} | |||
| Supposedly only collides with bullets, but does not. | |||
|} |
Latest revision as of 22:36, 24 August 2025
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
:
Name | Value | Solid to players | Solid to bullets | Solid to projectiles | Solid to physics | Solid to world | Description |
---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Default collision group | ||
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 .
| ||
No | No | No | No | Yes | Despite the name, this is the same as COLLISION_GROUP_DEBRIS , but does not collide with COLLISION_GROUP_PUSHAWAY .
| ||
No![]() |
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
| ||
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. | ||
Yes | Yes | Yes![]() |
Yes | Yes | Used by players, but NOT for movement collision. Does not collide with COLLISION_GROUP_PASSABLE_DOOR .
Except in In | ||
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.
| ||
Yes | Yes | Yes | Yes | Yes | Used by driveable vehicles. Always collides against COLLISION_GROUP_VEHICLE_CLIP
| ||
Yes![]() |
Yes | Yes![]() |
Yes | Yes | Used by player movement collision tests.
In | ||
Yes | Yes | Yes | Yes | Yes | Used by NPCs. Always collides with COLLISION_GROUP_DOOR_BLOCKER
| ||
No | No | No | No | No | Set on players/NPCs which enter a vehicle. | ||
No | Yes | Yes![]() |
Yes | Yes | Used by weapons, including when dropped. | ||
No | No | No | No | No | Used by func_vehicleclip. Ony collides with COLLISION_GROUP_VEHICLE .
| ||
Yes![]() |
Yes | No![]() |
Yes | Yes | Set on projectiles. Does not collide with other projectiles.
In | ||
No | No | No![]() |
No | No | Used by prop_door_rotating (creates a entity_blocker entity). Only supposed to collide with COLLISION_GROUP_NPC .
In Todo: Investigate the projectile behavior more
| ||
No | Yes | Yes | Yes | Yes | Used by func_door and func_door_rotating when the non-solid spawnflag is set. | ||
No | Yes | No | Yes | Yes | Set on entities dissolved with env_entity_dissolver. Only collides with COLLISION_GROUP_NONE .
| ||
No![]() |
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 ![]() ![]() | ||
Yes![]() |
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 .
| ||
Yes | Yes | Yes | Yes | Yes | Set on NPCs playing out a scripted_sequence, if NPC collisions are set to be disabled.
In |
Extended collision groups in Team Fortress 2 only:
Name | Value | Solid to players | Solid to hitscan | Solid to projectiles | Solid to physics | Solid to world | Description |
---|---|---|---|---|---|---|---|
No | Yes | N/A Depends |
Yes | Yes | Set by grenade projectiles. Does not collide with other TFCOLLISIONGROUP_GRENADES and rockets.
| ||
N/A Depends |
Yes | Yes | Yes | Yes | Set by Engineer buildings except teleporters. Uses team-specific contents on players. | ||
Yes | Yes | Yes | Yes | Yes | Set on teleporters. | ||
No | Yes | Yes | Yes | Yes | Set by placed sappers and the medigun shield (entity_medigun_shield). | ||
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.
| ||
Yes | No | No | No | No | Used by func_respawnroom and func_respawnroomvisualizer. | ||
No | Yes | Yes | Yes | Yes | Set by team-assigned tf_pumpkin_bombs. | ||
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.
|
Extended collision groups in Garry's Mod:
Name | Value | Solid to players | Solid to hitscan | Solid to projectiles | Solid to physics | Solid to world | Description |
---|---|---|---|---|---|---|---|
[Todo] Unknown | [Todo] Unknown | [Todo] Unknown | [Todo] Unknown | [Todo] Unknown | Doesn't collide with players/props |
Extended collision groups in Portal 2:
Name | Value | Solid to players | Solid to hitscan | Solid to projectiles | Solid to physics | Solid to world | Description |
---|---|---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | |||
No | No | No | No | No | Solid only to the camera's test trace. | ||
No | No | No | No | No | Solid only to the placement tool's test trace. | ||
No | Yes | Yes | Yes | Yes | Held objects that shouldn't collide with players. | ||
Yes | Yes | Yes | Yes | Yes | Cubes need a collision group that acts roughly like COLLISION_GROUP_NONE but doesn't collide with debris or interactive. | ||
No | No | No | No | No | Supposedly only collides with bullets, but does not. |