Physical Collision Map Asset

From COD Engine Research
Jump to: navigation, search

The physical collision map (phys_collmap) is the asset representation of what was previously known as the "physics geometry list" (PhysGeomList). This asset was added on Modern Warfare 2, and stayed for Modern Warfare 3 and Ghosts, Treyarch however continues to keep this part of the XModel asset. It has yet to change on any of the CoDs it has appeared in.

struct Bounds
{
  float midPoint[3];
  float halfSize[3];
};
 
struct PhysMass  //NOTE: PhysMass is used in DynEntityDef's in the collision map.
{
  float centerOfMass[3];
  float momentsOfInertia[3];
  float productsOfInertia[3];
};
 
#pragma pack(push, 4)
struct cplane_s  //NOTE: cplane_s is used in other assets, such as collision map
{
  float normal[3];
  float dist;
  char type;
  char signbits;
};
 
struct cbrushside_t  //NOTE: cbrushside_t is used in other assets, such as collision map
{
  cplane_s *plane;
  unsigned int materialNum;
};
 
struct BrushWrapper
{
  float mins[3];
  float maxs[3];
  unsigned int numsides;
  cbrushside_t *sides;
  char *baseAdjacentSide;
  __int16 axialMaterialNum[2][3];
  __int16 firstAdjacentSideOffsets[2][3];
  int totalEdgeCount;
  cplane_s *planes;
};
#pragma pack(pop)
 
struct PhysGeomInfo
{
  BrushWrapper *brush;
  int type;
  float orientation[3][3];
  float offset[3];
  float halfLengths[3];
};
 
struct PhysCollMap
{
  const char * name;
  unsigned int count;
  PhysGeomInfo *geoms;
  PhysMass mass;
  Bounds bounds;
};