6 #include "RbMovableItem.h"
9 #include "RbRigidBody.h"
10 #include "RbSimulator.h"
21 RbMaterialType::RbMaterialType()
28 RbMaterialType::~RbMaterialType()
52 Std_IsAboveMin((
float) 0, fltVal,
true,
"FrictionLinearPrimary",
true);
55 SetMaterialProperties();
79 Std_IsAboveMin((
float) 0, fltVal,
true,
"FrictionAngularPrimary",
true);
82 SetMaterialProperties();
143 SetMaterialProperties();
164 if(MaterialType::SetData(strType, strValue,
false))
167 if(strType ==
"FRICTIONLINEARPRIMARY")
173 if(strType ==
"FRICTIONANGULARPRIMARY")
179 if(strType ==
"RESTITUTION")
187 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
192 void RbMaterialType::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
194 MaterialType::QueryProperties(aryProperties);
196 aryProperties.Add(
new TypeProperty(
"FrictionLinearPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
197 aryProperties.Add(
new TypeProperty(
"FrictionAngularPrimary", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
198 aryProperties.Add(
new TypeProperty(
"Restitution", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
201 void RbMaterialType::Load(CStdXml &oXml)
203 MaterialType::Load(oXml);
229 if(!FindBodyByID(lpBody->ID(),
false))
246 if(FindBodyByID(lpBody->ID(),
false))
251 RigidBody *RbMaterialType::FindBodyByID(std::string strID,
bool bThrowError)
253 RigidBody *lpFind = NULL;
254 CStdMap<std::string, RigidBody *>::iterator oPos;
258 lpFind = oPos->second;
260 THROW_PARAM_ERROR(Al_Err_lIDNotFound, Al_Err_strIDNotFound,
"ID", strID);
282 void RbMaterialType::SetMaterialProperties()
virtual void Initialize()
Initializes this object.
virtual void AddRigidBodyAssociation(RigidBody *lpBody)
Associates a rigid body with this material type. This is used when you change something about this ma...
virtual float FrictionAngularPrimary()
Gets the angular primary friction coefficient.
virtual float FrictionLinearPrimary()
Gets the primary friction coefficient.
virtual float Restitution()
Gets the restitution for collisions between RigidBodies with these two materials. ...
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
bool Std_InValidRange(int iMinVal, int iMaxVal, int iVal, bool bThrowError, std::string strParamName)
Tests whether a number is within a valid range.
virtual void RemoveRigidBodyAssociation(RigidBody *lpBody)
Removes the rigid body association described by lpBody from this material.
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
float m_fltFrictionLinearPrimary
The primary linear coefficient of friction parameter.
float m_fltRestitution
The restitution of the collision between those two materials.
CStdMap< std::string, RigidBody * > m_aryBodies
All the rigid bodies associated with this material type.
virtual float FrictionAngularPrimaryConverted()
Gets the angular primary friction coefficient converted to match vortex values.
virtual void CreateDefaultUnits()
This takes the default values defined in the constructor and scales them according to the distance an...
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual int GetMaterialID(std::string strName)
Gets a material identifier used by the physics engine.
float m_fltFrictionAngularPrimary
The angular primary coefficient of friction parameter.(this simulates rolling resistance) ...
virtual void RegisterMaterialType()
Registers the material types within the physics engine.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.