PHYS: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
  // vec*: * floats
  // vec*: * floats
  // mat*x*: * times * floats.
  // mat*x*: * times * floats.
* pyhs
* body
** shapes
*** box
*** capsule
*** sphere
*** (height field [*])
* joints
** weld
** spherical
** shoulder
** (mouse [*])
** (distance [*])
** (revolute [*])
[*] supported by domino, but not available in wow


=PHYS=
=PHYS=
   short must_be_null; // PhysData::Load fails otherwise. (if (phys->token != 'PHYS' || phys->must_be_null) return false;)
   short must_be_null; // PhysData::Load fails otherwise. (if (phys->token != 'PHYS' || phys->must_be_null) return false;)


=BODY=
struct BODYEntry
{
  short type; // maps to dmBodyDef type enum. 0 -> 1, 1 -> 0, 2 -> 2. Only one should be of type 0 (root)
  short a;
  int b;
  int c;
  int d;
  short bone; // the bone this body is representing in the model.
  short f;
  int shapes_base; // starting at shapes[shapes_base]
  int shapes_count; // shapes_count shapes are in this body.
} bodies[];
=SHAP=
struct SHAPEntry
{
  short shapeType; // 0 -> box, 1 -> capsule, 2 -> sphere
  short shapeIndex; // into the corresponding chunk
  vec3 position?;
  float weight;
} shapes[];
=BOXS=
=BOXS=
  struct BOXSEntry
  struct BOXSEntry
Line 24: Line 62:
   vec4 d;
   vec4 d;
  } capsuleShapes[];
  } capsuleShapes[];
=SHAP=
=SPHS=
  struct SHAPEntry
  struct SPHSEntry
  {
  {
   short shapeType; // 0 -> box, 1 -> capsule, 2 -> sphere
   char a[0x10];
  short shapeIndex; // into the corresponding chunk
  } sphereShapes[];
  int c;
=JOIN=
  float d;
  struct JOINEntry
  int e;
  float f;
  } shapes[];
 
=BODY=
  struct BODYEntry
  {
  {
  short type; // maps to dmBodyDef type enum. 0 -> 1, 1 -> 0, 2 -> 2.
   int body_1;
  short a;
   int body_2;
   int b;
   int unk;
   int c;
   short jointType; // 0 == sphericalJoint, 1 == shoulderJoint, 2 == weldJoint
   int d;
   short jointId; // reference into the corresponding chunk entries.
   short e;
  } joins[];
  short f;
  int shapes_base; // starting at shapes[shapes_base]
   int shapes_count; // shapes_count shapes are in this body.
  } bodies[];


=WELJ=
=WELJ=
Line 58: Line 86:
   vec2 b;
   vec2 b;
  } weldJoins[];
  } weldJoins[];
=JOIN=
struct JOINEntry
{
  int a;
  int b;
  int c;
  short jointType; // 0 == sphericalJoint, 1 == shoulderJoint, 2 == weldJoint
  short jointId; // reference into the corresponding chunk entries.
} joins[];
=SPHJ=
=SPHJ=
  struct SPHJEntry
  struct SPHJEntry
Line 73: Line 91:
   char a[0x1C];
   char a[0x1C];
  } sphericalJointEntries[];
  } sphericalJointEntries[];
=SPHS=
struct SPHSEntry
{
  char a[0x10];
} sphereShapes[];
=SHOJ=
=SHOJ=
  struct SHOJEntry
  struct SHOJEntry

Revision as of 17:19, 7 April 2012

.phys files are chunked. The files are used by Blizzard's Domino physics engine which got added to WoW in the fourth expansion (MoP). In build 15464, there is one .phys file "item/objectcomponents/waist/buckle_panstart_a_01.phys". .phys files are an extension to M2s. The M2 requests a .phys file to be loaded by having GlobalModelFlags & 0x20 set.

The main PHYS chunk is followed by an unordered sequence of unique chunks of the other types.

// vec*: * floats
// mat*x*: * times * floats.
  • pyhs
  • body
    • shapes
      • box
      • capsule
      • sphere
      • (height field [*])
  • joints
    • weld
    • spherical
    • shoulder
    • (mouse [*])
    • (distance [*])
    • (revolute [*])

[*] supported by domino, but not available in wow

PHYS

 short must_be_null; // PhysData::Load fails otherwise. (if (phys->token != 'PHYS' || phys->must_be_null) return false;)

BODY

struct BODYEntry
{
  short type; // maps to dmBodyDef type enum. 0 -> 1, 1 -> 0, 2 -> 2. Only one should be of type 0 (root)
  short a;
  int b;
  int c;
  int d;
  short bone; // the bone this body is representing in the model.
  short f;
  int shapes_base; // starting at shapes[shapes_base]
  int shapes_count; // shapes_count shapes are in this body.
} bodies[];

SHAP

struct SHAPEntry
{
  short shapeType; // 0 -> box, 1 -> capsule, 2 -> sphere
  short shapeIndex; // into the corresponding chunk
  vec3 position?;
  float weight;
} shapes[];

BOXS

struct BOXSEntry
{
  mat3x3 a;
  vec3 b;
  vec3 c;
} boxShapes[];

CAPS

struct CAPSEntry
{
  int a;
  int b;
  int c;
  vec4 d;
} capsuleShapes[];

SPHS

struct SPHSEntry
{
  char a[0x10];
} sphereShapes[];

JOIN

struct JOINEntry
{
  int body_1;
  int body_2;
  int unk;
  short jointType; // 0 == sphericalJoint, 1 == shoulderJoint, 2 == weldJoint
  short jointId; // reference into the corresponding chunk entries.
} joins[];

WELJ

struct WELJEntry
{
  mat3x3 matrix;
  vec3 a;
  mat3x3 matrix2;
  vec3 a2;
  vec2 b;
} weldJoins[];

SPHJ

struct SPHJEntry
{
  char a[0x1C];
} sphericalJointEntries[];

SHOJ

struct SHOJEntry
{
  char a[0x6C];
} shoulderJoints[];