PhysPreset Asset: Difference between revisions

From COD Engine Research
No edit summary
mNo edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 3: Line 3:
[[Category:CoD4]]
[[Category:CoD4]]
[[Category:MW2]]
[[Category:MW2]]
[[Category:MW3]]
[[Category:Ghosts]]
[[Category:Ghosts]]
[[Category:AW]]
[[Category:WaW]]
[[Category:WaW]]
[[Category:BO1]]
[[Category:BO2]]
[[Category:BO2]]
 
[[Category:BO3]]
The PhysPreset asset controls the settings on dynamic objects. Any environmental object that moves from a gunshot or explosion has a physpreset to handle the force. The physpreset has existed in every CoD from the earliest Call of Duty 4 Alpha all the way to Ghosts, and it has changed very little.  
The PhysPreset asset controls the settings on dynamic objects. Any environmental object that moves from a gunshot or explosion has a physpreset to handle the force. The physpreset has existed in every CoD from the earliest Call of Duty 4 Alpha all the way to Ghosts, and it has changed very little.  
== Call of Duty 4 & Modern Warfare 2 ==
== Call of Duty 4 & Modern Warfare 2 ==
#pragma pack(push, 4)
<syntaxhighlight lang="cpp">
struct PhysPreset
#pragma pack(push, 4)
{
struct PhysPreset
  const char *name;
{
  int type;
  const char *name;
  float mass;
  int type;
  float bounce;
  float mass;
  float friction;
  float bounce;
  float bulletForceScale;
  float friction;
  float explosiveForceScale;
  float bulletForceScale;
  const char *sndAliasPrefix;
  float explosiveForceScale;
  float piecesSpreadFraction;
  const char *sndAliasPrefix;
  float piecesUpwardVelocity;
  float piecesSpreadFraction;
  bool tempDefaultToCylinder;
  float piecesUpwardVelocity;
};
  bool tempDefaultToCylinder;
#pragma pack(pop)
};
#pragma pack(pop)
</syntaxhighlight>
=== Type ===
=== Type ===
The type has never been identified. Changing it appears to alter nothing, and there are no instances of it being used.
The type has never been identified. Changing it appears to alter nothing, and there are no instances of it being used.
== World at War ==
== World at War ==
#pragma pack(push, 4)
<syntaxhighlight lang="cpp">
struct PhysPreset
#pragma pack(push, 4)
{
struct PhysPreset
  const char *name;
{
  float mass;
  const char *name;
  float bounce;
  int type;
  float friction;
  float mass;
  bool isFrictionInfinity;
  float bounce;
  float bulletForceScale;
  float friction;
  float explosiveForceScale;
  float bulletForceScale;
  const char *sndAliasPrefix;
  float explosiveForceScale;
  float piecesSpreadFraction;
  const char *sndAliasPrefix;
  float piecesUpwardVelocity;
  float piecesSpreadFraction;
  int bCanFloat;
  float piecesUpwardVelocity;
  float gravityScale;
  int bCanFloat;
};
  float gravityScale;
#pragma pack(pop)
};
== Black Ops 2 ==
#pragma pack(pop)
#pragma pack(push, 4)
</syntaxhighlight>
struct PhysPreset
== Black Ops 1 & 2 & 3 ==
{
<syntaxhighlight lang="cpp">
  const char *name;
#pragma pack(push, 4)
  int type;
struct PhysPreset
  float mass;
{
  float bounce;
  const char *name;
  float friction;
  int flags;
  float bulletForceScale;
  float mass;
  float explosiveForceScale;
  float bounce;
  const char *sndAliasPrefix;
  float friction;
  float piecesSpreadFraction;
#ifdef BO3
  float piecesUpwardVelocity;
  float damping_linear;
  int bCanFloat;
  float damping_angular;
  float gravityScale;
#endif
  float massOffset[3];
  float bulletForceScale;
  float buoyancyMin[3];  
  float explosiveForceScale;
  float buoyancyMax[3];
  const char *sndAliasPrefix;
};
#ifndef BO3
#pragma pack(pop)
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
#endif
  int canFloat;
  float gravityScale;
  vec3_t centerOfMassOffset;
  vec3_t buoyancyBoxMin;
  vec3_t buoyancyBoxMax;
#ifdef BO3
  FxEffectDef * trailFX;
  FxImpactTable * impactsFXTable;
  SoundsImpactTable * impactsSoundsTable;
#endif
};
#pragma pack(pop)
</syntaxhighlight>
 
== Modern Warfare 3 ==
<syntaxhighlight lang="cpp">
#pragma pack(push, 4)
struct PhysPreset
{
  const char *name;
  int type;
  float mass;
  float bounce;
  float friction;
  float bulletForceScale;
  float explosiveForceScale;
  const char *sndAliasPrefix;
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
  int unknowns[7];
};
#pragma pack(pop)
</syntaxhighlight>
== Ghosts ==
== Ghosts ==
#pragma pack(push, 4)
<syntaxhighlight lang="cpp">
struct PhysPreset
enum PhysPresetScaling
{
{
  const char *name;
  PHYSPRESET_SCALING_LINEAR = 0x0,
  int type;
  PHYSPRESET_SCALING_QUADRATIC = 0x1,
  float mass;
  PHYSPRESET_SCALING_COUNT = 0x2,
  float bounce;
};
  float friction;
 
  float bulletForceScale;
struct __declspec(align(8)) PhysPreset
  float explosiveForceScale;
{
  const char *sndAliasPrefix;
  const char *name;
  float piecesSpreadFraction;
  int type;
  float piecesUpwardVelocity;
  float mass;
  int unknowns[9];
  float bounce;
};
  float friction;
#pragma pack(pop)
  float bulletForceScale;
  float explosiveForceScale;
  const char *sndAliasPrefix;
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
  float minMomentum;
  float maxMomentum;
  float minVolume;
  float maxVolume;
  float minPitch;
  float maxPitch;
  PhysPresetScaling volumeType;
  PhysPresetScaling pitchType;
  bool tempDefaultToCylinder;
  bool perSurfaceSndAlias;
};
</syntaxhighlight>
 
== Advanced Warfare ==
<syntaxhighlight lang="cpp">
#pragma pack(push, 4)
struct PhysPreset
{
  const char *name;
  int type;
  float mass;
  float bounce;
  float friction;
  float bulletForceScale;
  float explosiveForceScale;
  char unknown[4];
  const char *sndAliasPrefix;
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
  int unknowns[9];
};
#pragma pack(pop)
</syntaxhighlight>
 
== Source Format ==
== Source Format ==
The physpreset source files are raw text files with no extension, located at "raw/physic/". 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 physpreset the identifier string is "PHYSIC". PhysPresets are unique because they're the only asset found so far with a setting in the source that doesn't have a setting in the asset. The physpreset source files include an extra setting, "isFrictionInfinity", a bool. If it is 1, then the source file's friction will say it is 0.5, but once compiled the actual friction will be 340282346638528860000000000000000000000. For example, here is the CoD4 source for "brick" found at "raw/physic/brick".
The physpreset source files are raw text files with no extension, located at "raw/physic/". 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 physpreset the identifier string is "PHYSIC". PhysPresets are unique because they're the only asset found so far with a setting in the source that doesn't have a setting in the asset. The physpreset source files include an extra setting, "isFrictionInfinity", a bool (At least on IW games, on Treyarch games it has been added). If it is 1, then the source file's friction will say it is 0.5, but once compiled the actual friction will be 340282346638528860000000000000000000000. For example, here is the CoD4 source for "brick" found at "raw/physic/brick".
  PHYSIC\sndAliasPrefix\physics_brick\mass\5\friction\0.5\isFrictionInfinity\0\bounce\0.3\bulletForceScale\0.6\explosiveForceScale\0.12\piecesSpreadFraction\0\piecesUpwardVelocity\0\tempDefaultToCylinder\0
  PHYSIC\sndAliasPrefix\physics_brick\mass\5\friction\0.5\isFrictionInfinity\0\bounce\0.3\bulletForceScale\0.6\explosiveForceScale\0.12\piecesSpreadFraction\0\piecesUpwardVelocity\0\tempDefaultToCylinder\0

Latest revision as of 22:43, 1 September 2015

The PhysPreset asset controls the settings on dynamic objects. Any environmental object that moves from a gunshot or explosion has a physpreset to handle the force. The physpreset has existed in every CoD from the earliest Call of Duty 4 Alpha all the way to Ghosts, and it has changed very little.

Call of Duty 4 & Modern Warfare 2

#pragma pack(push, 4)
struct PhysPreset
{
  const char *name;
  int type;
  float mass;
  float bounce;
  float friction;
  float bulletForceScale;
  float explosiveForceScale;
  const char *sndAliasPrefix;
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
  bool tempDefaultToCylinder;
};
#pragma pack(pop)

Type

The type has never been identified. Changing it appears to alter nothing, and there are no instances of it being used.

World at War

#pragma pack(push, 4)
struct PhysPreset
{	
  const char *name;
  int type;
  float mass;
  float bounce;
  float friction;
  float bulletForceScale;	
  float explosiveForceScale;	
  const char *sndAliasPrefix;	
  float piecesSpreadFraction;	
  float piecesUpwardVelocity;	
  int bCanFloat;	
  float gravityScale;
};
#pragma pack(pop)

Black Ops 1 & 2 & 3

#pragma pack(push, 4)
struct PhysPreset
{
  const char *name;
  int flags;
  float mass;
  float bounce;
  float friction;
#ifdef BO3
  float damping_linear;
  float damping_angular;
#endif
  float bulletForceScale;
  float explosiveForceScale;
  const char *sndAliasPrefix;
#ifndef BO3
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
#endif
  int canFloat;
  float gravityScale;
  vec3_t centerOfMassOffset;
  vec3_t buoyancyBoxMin;
  vec3_t buoyancyBoxMax;
#ifdef BO3
  FxEffectDef * trailFX;
  FxImpactTable * impactsFXTable;
  SoundsImpactTable * impactsSoundsTable;
#endif
};
#pragma pack(pop)

Modern Warfare 3

#pragma pack(push, 4)
struct PhysPreset
{	
  const char *name;	
  int type;	
  float mass;
  float bounce;
  float friction;	
  float bulletForceScale;	
  float explosiveForceScale;	
  const char *sndAliasPrefix;	
  float piecesSpreadFraction;	
  float piecesUpwardVelocity;
  int unknowns[7];
};
#pragma pack(pop)

Ghosts

enum PhysPresetScaling
{
  PHYSPRESET_SCALING_LINEAR = 0x0,
  PHYSPRESET_SCALING_QUADRATIC = 0x1,
  PHYSPRESET_SCALING_COUNT = 0x2,
};

struct __declspec(align(8)) PhysPreset
{
  const char *name;
  int type;
  float mass;
  float bounce;
  float friction;
  float bulletForceScale;
  float explosiveForceScale;
  const char *sndAliasPrefix;
  float piecesSpreadFraction;
  float piecesUpwardVelocity;
  float minMomentum;
  float maxMomentum;
  float minVolume;
  float maxVolume;
  float minPitch;
  float maxPitch;
  PhysPresetScaling volumeType;
  PhysPresetScaling pitchType;
  bool tempDefaultToCylinder;
  bool perSurfaceSndAlias;
};

Advanced Warfare

#pragma pack(push, 4)
struct PhysPreset
{	
  const char *name;	
  int type;	
  float mass;
  float bounce;
  float friction;	
  float bulletForceScale;	
  float explosiveForceScale;
  char unknown[4];
  const char *sndAliasPrefix;	
  float piecesSpreadFraction;	
  float piecesUpwardVelocity;
  int unknowns[9];
};
#pragma pack(pop)

Source Format

The physpreset source files are raw text files with no extension, located at "raw/physic/". 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 physpreset the identifier string is "PHYSIC". PhysPresets are unique because they're the only asset found so far with a setting in the source that doesn't have a setting in the asset. The physpreset source files include an extra setting, "isFrictionInfinity", a bool (At least on IW games, on Treyarch games it has been added). If it is 1, then the source file's friction will say it is 0.5, but once compiled the actual friction will be 340282346638528860000000000000000000000. For example, here is the CoD4 source for "brick" found at "raw/physic/brick".

PHYSIC\sndAliasPrefix\physics_brick\mass\5\friction\0.5\isFrictionInfinity\0\bounce\0.3\bulletForceScale\0.6\explosiveForceScale\0.12\piecesSpreadFraction\0\piecesUpwardVelocity\0\tempDefaultToCylinder\0