PhysConstraints Asset

From COD Engine Research
Jump to: navigation, search

The physconstraints asset holds physical constraint settings for dynamic models. This asset exists only in World at War, Black Ops 1 and Black Ops 2. In World at War the header is 0x988 bytes, however Black Ops 1 and 2 added an extra 0x10 bytes to each physconstraint, making the header size 0xA88.

enum ConstraintType
{
  CONSTRAINT_NONE = 0x0,
  CONSTRAINT_POINT = 0x1,
  CONSTRAINT_DISTANCE = 0x2,
  CONSTRAINT_HINGE = 0x3,
  CONSTRAINT_JOINT = 0x4,
  CONSTRAINT_ACTUATOR = 0x5,
  CONSTRAINT_FAKE_SHAKE = 0x6,
  CONSTRAINT_LAUNCH = 0x7,
  CONSTRAINT_ROPE = 0x8,
#if defined(BO1) || defined(BO2)
  CONSTRAINT_LIGHT = 0x9,
#endif
  NUM_CONSTRAINT_TYPES
};
 
enum AttachPointType
{
  ATTACH_POINT_WORLD = 0x0,
  ATTACH_POINT_DYNENT = 0x1,
  ATTACH_POINT_ENT = 0x2,
  ATTACH_POINT_BONE = 0x3
};
 
struct PhysConstraint
{
  ScriptString targetname;
  ConstraintType type;
  AttachPointType attach_point_type1;
  int target_index1;
  ScriptString target_ent1;
  const char *target_bone1;
  AttachPointType attach_point_type2;
  int target_index2;
  ScriptString target_ent2;
  const char *target_bone2;
  vec3_t offset;
  vec3_t pos;
  vec3_t pos2;
  vec3_t dir;
  int flags;
  int timeout;
  int min_health;
  int max_health;
  float distance;
  float damp;
  float power;
  vec3_t scale;
  float spin_scale;
  float minAngle;
  float maxAngle;
  Material *material;
  int constraintHandle;
  int rope_index;
#if defined(BO1) || defined(BO2)
  int centity_num[4];
#endif
};
 
struct PhysConstraints
{
  const char * name;
  unsigned int count;
  PhysConstraint data[0x10];
};

Source Format

The physconstraints source files are raw text files with no extension, located at "raw/physconstraints/". They use the same format as many other assets, with each setting name and value separated by a back-slash. The first setting identifies the file, and for physconstraints the identifier string is "PHYSCONSTRAINTS". For example, here is "veh_car_launch_glass_f_mp" from BO1:

PHYSCONSTRAINTS\c1_type\launch\c1_bone1_name\\c1_bone2_name\\c1_timeout\0\c1_offsetX\0\c1_offsetY\0\c1_offsetZ\0\c1_min_health\-10000\c1_max_health\10000\c1_damp\2\c1_power\2\c1_shakescalex\0.5\c1_shakescaley\0.5\c1_shakescalez\1\c1_min_angle\0\c1_max_angle\0\c1_yaw\0\c1_pitch\45\c1_spin_scale\3\c2_type\none\c2_bone1_name\\c2_bone2_name\\c2_timeout\0\c2_offsetX\0\c2_offsetY\0\c2_offsetZ\0\c2_min_health\-10000\c2_max_health\10000\c2_damp\0\c2_power\0\c2_min_angle\0\c2_max_angle\0\c3_type\none\c3_bone1_name\\c3_bone2_name\\c3_timeout\0\c3_offsetX\0\c3_offsetY\0\c3_offsetZ\0\c3_min_health\-10000\c3_max_health\10000\c3_damp\0\c3_power\0\c3_min_angle\0\c3_max_angle\0\c4_type\none\c4_bone1_name\\c4_bone2_name\\c4_timeout\0\c4_offsetX\0\c4_offsetY\0\c4_offsetZ\0\c4_min_health\-10000\c4_max_health\10000\c4_damp\0\c4_power\0\c4_min_angle\0\c4_max_angle\0