PhysConstraints Asset: Difference between revisions

From COD Engine Research
mNo edit summary
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
[[Category:Assets]]
[[Category:Assets]]
[[Category:WaW]]
[[Category:BO1]]
[[Category:BO1]]
[[Category:BO2]]
[[Category:BO2]]
The physconstraints asset holds physical constraint settings for dynamic models. This asset exists only in Black Ops 1 and Black Ops 2.
[[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
{
{
CONSTRAINT_NONE = 0x0,
  CONSTRAINT_NONE = 0x0,
CONSTRAINT_POINT = 0x1,
  CONSTRAINT_POINT = 0x1,
CONSTRAINT_DISTANCE = 0x2,
  CONSTRAINT_DISTANCE = 0x2,
CONSTRAINT_HINGE = 0x3,
  CONSTRAINT_HINGE = 0x3,
CONSTRAINT_JOINT = 0x4,
  CONSTRAINT_JOINT = 0x4,
CONSTRAINT_ACTUATOR = 0x5,
  CONSTRAINT_ACTUATOR = 0x5,
CONSTRAINT_FAKE_SHAKE = 0x6,
  CONSTRAINT_FAKE_SHAKE = 0x6,
CONSTRAINT_LAUNCH = 0x7,
  CONSTRAINT_LAUNCH = 0x7,
CONSTRAINT_ROPE = 0x8,
  CONSTRAINT_ROPE = 0x8,
CONSTRAINT_LIGHT = 0x9,
#if defined(BO1) || defined(BO2)
NUM_CONSTRAINT_TYPES
  CONSTRAINT_LIGHT = 0x9,
#endif
  NUM_CONSTRAINT_TYPES
};
};


struct PhysConstraint // 0xA8
enum AttachPointType
{
{
  ScriptString scriptString1;
  ATTACH_POINT_WORLD = 0x0,
  short unknownShort1;
  ATTACH_POINT_DYNENT = 0x1,
ConstraintType type;
  ATTACH_POINT_ENT = 0x2,
  char unknownData1[8];
  ATTACH_POINT_BONE = 0x3
  ScriptString scriptString2;
  short unknownShort2;
char * bone1_name;
  char unknownData2[8];
  ScriptString scriptString3;
  short unknownShort3;
char * bone2_name;
float offsetX;
float offsetY;
float offsetZ;
  float unknown1[3];
  float unknown2[3];
  float unknown3[3];
int timeout;
int min_health;
int max_health;
    int unknown4;
float damp;
float power;
float shakescalex;
float shakescaley;
float shakescalez;
float spin_scale;
float min_angle;
float max_angle;
Material *material;
  char unknownData4[0x18];
};
};


struct PhysConstraints // 0xA88
struct PhysConstraint
{
{
char * name;
  ScriptString targetname;
int usedConstraints;
  ConstraintType type;
PhysConstraint contraints[0x10];
  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
};
};
</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