ezEngine Release 25.08
Loading...
Searching...
No Matches
ezWeightCategoryConfig Class Reference

Public Member Functions

void Save (ezStreamWriter &inout_stream) const
 
void Load (ezStreamReader &inout_stream)
 
ezResult Save (ezStringView sFile=s_sConfigFile) const
 
ezResult Load (ezStringView sFile=s_sConfigFile)
 
ezUInt8 FindByName (ezTempHashedString sName) const
 Returns the index of the element with the searched name, or InvalidKey, if it doesn't exist.
 
ezUInt8 GetFreeKey () const
 Returns the next free key, or InvalidKey, if the list is full.
 
float GetMassForWeightCategory (ezUInt8 uiWeightCategory, float fDefaultMass, float fCustomMass, float fWeightScale, float fMinMass=1.0f, float fMaxMass=1000.0f) const
 Returns the mass according to the weight category.
 

Public Attributes

ezArrayMap< ezUInt8, ezWeightCategorym_Categories
 

Static Public Attributes

static constexpr const ezStringView s_sConfigFile = ":project/RuntimeConfigs/WeightCategories.cfg"_ezsv
 
static constexpr const ezUInt8 InvalidKey = 255
 value for when a key doesn't exist
 
static constexpr const ezUInt8 FirstValidKey = 10
 any key smaller than this is not a valid weight category key, but may represent another option
 
static constexpr const ezUInt8 DefaultValueKey = 0
 the impulse type key with this value corresponds to "<Default>", which stands for a good default mass (that may be different for different component types)
 
static constexpr const ezUInt8 CustomMassKey = 1
 the impulse type key with this value corresponds to "<Custom Mass>"
 
static constexpr const ezUInt8 CustomDensityKey = 2
 the impulse type key with this value corresponds to "<Custom Density>"
 

Member Function Documentation

◆ GetMassForWeightCategory()

float ezWeightCategoryConfig::GetMassForWeightCategory ( ezUInt8  uiWeightCategory,
float  fDefaultMass,
float  fCustomMass,
float  fWeightScale,
float  fMinMass = 1.0f,
float  fMaxMass = 1000.0f 
) const

Returns the mass according to the weight category.

  • The default mass, if uiWeightCategory == DefaultValueKey
  • The custom mass, if uiWeightCategory == CustomMassKey
  • 0, if uiWeightCategory == CustomDensityKey
  • the mapped mass (scaled and clamped) for an existing key
  • the default value, if the key doesn't exist

The documentation for this class was generated from the following files: