PhysConstraints Asset: Difference between revisions

From COD Engine Research
No edit summary
No edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 4: Line 4:
[[Category:BO1]]
[[Category:BO1]]
[[Category:BO2]]
[[Category:BO2]]
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.
[[Category:BO3]]
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. Black Ops 3 removed the static array making the header size only 0xC bytes
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
enum ConstraintType
enum ConstraintType
Line 17: Line 18:
   CONSTRAINT_LAUNCH = 0x7,
   CONSTRAINT_LAUNCH = 0x7,
   CONSTRAINT_ROPE = 0x8,
   CONSTRAINT_ROPE = 0x8,
#ifdef BO1 || BO2
#if defined(BO1) || defined(BO2)
   CONSTRAINT_LIGHT = 0x9,
   CONSTRAINT_LIGHT = 0x9,
#endif
#endif
   NUM_CONSTRAINT_TYPES
   NUM_CONSTRAINT_TYPES
};
enum AttachPointType
{
  ATTACH_POINT_WORLD = 0x0,
  ATTACH_POINT_DYNENT = 0x1,
  ATTACH_POINT_ENT = 0x2,
  ATTACH_POINT_BONE = 0x3
};
};


struct PhysConstraint
struct PhysConstraint
{
{
      ScriptString scriptString1;
  ScriptString targetname;
      short unknown1;
   ConstraintType type;
   ConstraintType type;
      char unknown2[8];
  AttachPointType attach_point_type1;
      ScriptString scriptString2;
  int target_index1;
      short unknown3;
  ScriptString target_ent1;
   char * bone1_name;
#ifdef BO3
      char unknown4[8];
  ScriptString target_bone1;
      ScriptString scriptString3;
#else
      short unknown5;
   const char *target_bone1;
   char * bone2_name;
#endif
   float offset[3];
  AttachPointType attach_point_type2;
      float unknown6[3];
  int target_index2;
      float unknown7[3];
  ScriptString target_ent2;
      float unknown8[3];
#ifdef BO3
  ScriptString target_bone2;
#else
   const char *target_bone2;
#endif
   vec3_t offset;
  vec3_t pos;
  vec3_t pos2;
  vec3_t dir;
  int flags;
   int timeout;
   int timeout;
   int min_health;
   int min_health;
   int max_health;
   int max_health;
      int unknown9;
  float distance;
   float damp;
   float damp;
   float power;
   float power;
   float shakescalex;
   vec3_t scale;
  float shakescaley;
  float shakescalez;
   float spin_scale;
   float spin_scale;
   float min_angle;
   float minAngle;
   float max_angle;
   float maxAngle;
   Material *material;
   Material *material;
      char unknown10[8];
  int constraintHandle;
#ifdef BO1 || BO2
  int rope_index;
      int unknown11[4];
#ifdef BO3
  int unknown[9];
#endif
#if defined(BO1) || defined(BO2)
  int centity_num[4];
#endif
#endif
};
};
Line 62: Line 81:
{
{
   const char * name;
   const char * name;
   int usedConstraints;
   unsigned int count;
   PhysConstraint contraints[0x10];
#ifdef BO3
   PhysConstraint *data;
#else
  PhysConstraint data[0x10];
#endif
};
};
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 07:36, 31 October 2015

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. Black Ops 3 removed the static array making the header size only 0xC bytes

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;
#ifdef BO3
  ScriptString target_bone1;
#else
  const char *target_bone1;
#endif
  AttachPointType attach_point_type2;
  int target_index2;
  ScriptString target_ent2;
#ifdef BO3
  ScriptString target_bone2;
#else
  const char *target_bone2;
#endif
  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;
#ifdef BO3
  int unknown[9];
#endif
#if defined(BO1) || defined(BO2)
  int centity_num[4];
#endif
};

struct PhysConstraints
{
  const char * name;
  unsigned int count;
#ifdef BO3
  PhysConstraint *data;
#else
  PhysConstraint data[0x10];
#endif
};

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