Player Solidity

From Valve Developer Community
Jump to: navigation, search

Player collisions aren't that simple because there are multiple systems for them.

There are three systems that interact with player collisions:

Gamemovement - the player sweeps a box through the world, hitting things that are solid. This is where the player's movement happens. If you want to modify which things impede the player's movement, you do it in gamemovement.

Player's solid flags / solid type / collision property - Other entities also sweep a box through the world like the player does. These flags determine whether the player is solid to them (along with those entities' trace filters and contents masks). This will determine whether NPCs bump into the player, etc.

Vphysics object - this is only used to control collisions between the player and entities that are MOVETYPE_VPHYSICS. In HL2 (this is not true for all of the multiplayer games, so it depends on which set of rules you are using) the player is represented by a separate physics object. After gamemovement determines where the player would like to go the physics simulator runs and tries to move this proxy/shadow object to that location. If it succeeds then nothing changes. Otherwise if it hits some simulated object along the way the player code may decide to to the results of the physics simulation instead of gamemovement.

Information c/o Jay Stelly