8 #include "IMovableItemCallback.h"
9 #include "ISimGUICallback.h"
13 #include "IPhysicsMovableItem.h"
14 #include "IPhysicsBody.h"
16 #include "MovableItem.h"
119 m_lpSim->RemoveFromExtractExtraData(
this);
128 {
Std_TraceMsg(0,
"Caught Error in desctructor of Body\r\n",
"", -1,
false,
true);}
153 return COLLISION_SELECTION_MODE;
155 return GRAPHICS_SELECTION_MODE;
183 float fltTotalMass = Mass();
187 for(
int iIndex=0; iIndex<iCount; iIndex++)
192 vMass += ( (lpChild->
Position() + lpChild->CenterOfMass()) * lpChild->Mass());
193 fltTotalMass += lpChild->Mass();
198 vMass /= fltTotalMass;
200 vMass.ClearNearZero();
247 CStdFPoint vPos(fltX, fltY, fltZ);
353 float RigidBody::Mass() {
return m_fltMass;}
355 void RigidBody::Mass(
float fltVal,
bool bUseScaling)
357 Mass(fltVal, bUseScaling,
true);
360 void RigidBody::Mass(
float fltVal,
bool bUseScaling,
bool bPhysicsCallback)
374 float RigidBody::MassWithChildren()
376 float fltTotalMass = Mass();
378 for(
int iIndex=0; iIndex<iCount; iIndex++)
381 fltTotalMass += lpChild->MassWithChildren();
389 void RigidBody::Volume(
float fltVal,
bool bUseScaling)
610 for(
int iIndex=0; iIndex<iCount; iIndex++)
630 for(
int iIndex=0; iIndex<iCount; iIndex++)
664 m_lpSim->RemoveFoodSource(
this);
737 Std_InValidRange((
float) 0, (
float) 100000, fltVal,
true,
"FoodReplenishRate");
762 Std_InValidRange((
float) 0, (
float) 100000, fltVal,
true,
"FoodEnergyContent");
786 Std_InValidRange((
float) 0, (
float) 100000, fltVal,
true,
"MaxFoodQuantity");
811 Std_InValidRange((
float) 0, (
float) 1000, fltVal,
true,
"RigidBody::LinearVelocityDamping");
842 Std_InValidRange((
float) 0, (
float) 1000, fltVal,
true,
"RigidBody::AngularVelocityDamping");
933 CStdFPoint vPos(fltX, fltY, fltZ);
1027 CStdFPoint vPos(fltX, fltY, fltZ);
1090 CStdFPoint vPos(fltX, fltY, fltZ);
1228 bool RigidBody::HasCollisionGeometry()
1346 THROW_TEXT_ERROR(Al_Err_lBodyNotDefined, Al_Err_strBodyNotDefined,
"EnableCollision");
1377 THROW_TEXT_ERROR(Al_Err_lBodyNotDefined, Al_Err_strBodyNotDefined,
"DisableCollision");
1406 std::unordered_set<RigidBody *>::iterator oPos;
1411 else if(bThrowError)
1412 THROW_TEXT_ERROR(Al_Err_lItemNotFound, Al_Err_strItemNotFound,
"Exclusion List Body Part: " + lpBody->
ID());
1453 if(HasCollisionGeometry())
1466 for(
int iIndex=0; iIndex<iCount; iIndex++)
1494 for(
int iIndex=0; iIndex<iCount; iIndex++)
1506 for(
int iIndex=0; iIndex<iCount; iIndex++)
1551 for(
int iIndex=0; iIndex<iCount; iIndex++)
1588 for(
int iIndex=0; iIndex<iCount; iIndex++)
1603 if(strType ==
"BODYFORCEX")
1604 return BODY_FORCE_X_TYPE;
1605 else if(strType ==
"BODYFORCEY")
1606 return BODY_FORCE_Y_TYPE;
1607 else if(strType ==
"BODYFORCEZ")
1608 return BODY_FORCE_Z_TYPE;
1609 else if(strType ==
"STICKYON")
1610 return STICKY_ON_TYPE;
1611 else if(strType ==
"STICKYOFF")
1612 return STICKY_OFF_TYPE;
1620 if(iTargetDataType == STICKY_ON_TYPE && fltInput > 0.5)
1622 else if(iTargetDataType == STICKY_OFF_TYPE && fltInput > 0.5)
1653 for(
int iIndex=0; iIndex<iCount; iIndex++)
1660 #pragma region DataAccesMethods
1662 float *RigidBody::GetDataPointer(
const std::string &strDataType)
1666 if(strType ==
"FOODQUANTITY")
1668 if(strType ==
"FOODEATEN")
1670 if(strType ==
"ENABLE")
1672 if(strType ==
"CONTACTCOUNT")
1674 if(strType ==
"DENSITY")
1679 if(strType ==
"MASS")
1684 if(strType ==
"VOLUME")
1689 if(strType ==
"STICKYON")
1694 float *lpData = NULL;
1697 float *lpData = NULL;
1699 if(lpData)
return lpData;
1702 return BodyPart::GetDataPointer(strDataType);
1706 bool RigidBody::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
1710 if(BodyPart::SetData(strType, strValue,
false))
1713 if(strType ==
"FREEZE")
1719 if(strType ==
"DENSITY")
1721 Density((
float) atof(strValue.c_str()));
1725 if(strType ==
"MASS")
1727 Mass((
float) atof(strValue.c_str()));
1731 if(strType ==
"COM")
1737 if(strType ==
"FOODSOURCE")
1743 if(strType ==
"FOODQUANTITY")
1749 if(strType ==
"MAXFOODQUANTITY")
1755 if(strType ==
"FOODREPLENISHRATE")
1761 if(strType ==
"FOODENERGYCONTENT")
1767 if(strDataType ==
"BUOYANCYCENTER")
1773 if(strType ==
"BUOYANCYSCALE")
1779 if(strDataType ==
"LINEARDRAG")
1785 if(strDataType ==
"LINEARDRAG.X")
1791 if(strDataType ==
"LINEARDRAG.Y")
1797 if(strDataType ==
"LINEARDRAG.Z")
1803 if(strDataType ==
"ANGULARDRAG")
1809 if(strDataType ==
"ANGULARDRAG.X")
1815 if(strDataType ==
"ANGULARDRAG.Y")
1821 if(strDataType ==
"ANGULARDRAG.Z")
1827 if(strType ==
"MAXHYDROFORCE")
1833 if(strType ==
"MAXHYDROTORQUE")
1839 if(strType ==
"MAGNUS")
1841 Magnus((
float) atof(strValue.c_str()));
1845 if(strDataType ==
"ENABLEFLUIDS")
1851 if(strDataType ==
"MATERIALTYPEID")
1857 if(strDataType ==
"ISSTICKYPART")
1865 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
1870 void RigidBody::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
1872 BodyPart::QueryProperties(aryProperties);
1874 aryProperties.Add(
new TypeProperty(
"FoodEaten", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1875 aryProperties.Add(
new TypeProperty(
"Enable", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1876 aryProperties.Add(
new TypeProperty(
"ContactCount", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1877 aryProperties.Add(
new TypeProperty(
"Volume", AnimatPropertyType::Float, AnimatPropertyDirection::Get));
1878 aryProperties.Add(
new TypeProperty(
"StickyOn", AnimatPropertyType::Boolean, AnimatPropertyDirection::Get));
1880 aryProperties.Add(
new TypeProperty(
"Freeze", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
1881 aryProperties.Add(
new TypeProperty(
"Density", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
1882 aryProperties.Add(
new TypeProperty(
"Mass", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
1883 aryProperties.Add(
new TypeProperty(
"CenterOfMass", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
1884 aryProperties.Add(
new TypeProperty(
"FoodSource", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
1885 aryProperties.Add(
new TypeProperty(
"FoodQuantity", AnimatPropertyType::Float, AnimatPropertyDirection::Both));
1886 aryProperties.Add(
new TypeProperty(
"MaxFoodQuantity", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1887 aryProperties.Add(
new TypeProperty(
"FoodReplenishRate", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1888 aryProperties.Add(
new TypeProperty(
"FoodEnergyContent", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1889 aryProperties.Add(
new TypeProperty(
"BuoyancyCenter", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
1890 aryProperties.Add(
new TypeProperty(
"BuoyancyScale", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1891 aryProperties.Add(
new TypeProperty(
"LinearDrag", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
1892 aryProperties.Add(
new TypeProperty(
"LinearDrag.X", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1893 aryProperties.Add(
new TypeProperty(
"LinearDrag.Y", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1894 aryProperties.Add(
new TypeProperty(
"LinearDrag.Z", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1895 aryProperties.Add(
new TypeProperty(
"AngularDrag", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
1896 aryProperties.Add(
new TypeProperty(
"AngularDrag.X", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1897 aryProperties.Add(
new TypeProperty(
"AngularDrag.Y", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1898 aryProperties.Add(
new TypeProperty(
"AngularDrag.Z", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1899 aryProperties.Add(
new TypeProperty(
"MaxHydroForce", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1900 aryProperties.Add(
new TypeProperty(
"MaxHydroTorque", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1901 aryProperties.Add(
new TypeProperty(
"Magnus", AnimatPropertyType::Float, AnimatPropertyDirection::Set));
1902 aryProperties.Add(
new TypeProperty(
"EnableFluids", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
1903 aryProperties.Add(
new TypeProperty(
"MaterialTypeID", AnimatPropertyType::String, AnimatPropertyDirection::Set));
1904 aryProperties.Add(
new TypeProperty(
"IsStickyPart", AnimatPropertyType::Boolean, AnimatPropertyDirection::Set));
1907 bool RigidBody::AddItem(
const std::string &strItemType,
const std::string &strXml,
bool bThrowError,
bool bDoNotInit)
1911 if(strType ==
"RIGIDBODY")
1917 if(strType ==
"CONTACTSENSOR")
1923 if(strType ==
"ODOR")
1931 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
1940 if(strType ==
"RIGIDBODY")
1946 if(strType ==
"CONTACTSENSOR")
1952 if(strType ==
"ODOR")
1960 THROW_PARAM_ERROR(Al_Err_lInvalidItemType, Al_Err_strInvalidItemType,
"Item Type", strItemType);
1995 m_lpSim->NotifyRigidBodyAdded(lpBody->
ID());
2015 bool bHasStaticJoint = bHasStaticJoint = lpChild->
HasStaticJoint();
2025 m_lpSim->NotifyRigidBodyRemoved(strID);
2047 for(
int iIndex=0; iIndex<iCount; iIndex++)
2052 THROW_TEXT_ERROR(Al_Err_lBodyOrJointIDNotFound, Al_Err_strBodyOrJointIDNotFound,
"ID");
2072 LoadContactSensor(oXml);
2105 UpdateChildPhysicsPosFromGraphics();
2108 void RigidBody::UpdateChildPhysicsPosFromGraphics()
2114 for(
int iIndex=0; iIndex<iCount; iIndex++)
2128 Position(vTemp,
true,
false,
false);
2138 void RigidBody::Load(
CStdXml &oXml)
2145 m_lpSim->IncrementPhysicsBodyCount();
2147 BodyPart::Load(oXml);
2151 vPoint.Set(0, 0, 0);
2166 Mass(m_fltMass,
true,
false);
2183 vPoint.Set(0, 0, 0);
2187 vPoint.Set(0, 0, 0);
2218 for(
int iIndex=0; iIndex<iChildCount; iIndex++)
2226 LoadContactSensor(oXml);
2233 for(
int iIndex=0; iIndex<iChildCount; iIndex++)
2244 void RigidBody::LoadContactSensor(
CStdXml &oXml)
2247 THROW_TEXT_ERROR(Al_Err_lContactSensorExists, Al_Err_strContactSensorExists,
" RigidBodyID: " +
m_strID);
2271 std::string strType;
2282 THROW_TEXT_ERROR(Al_Err_lConvertingClassToType, Al_Err_strConvertingClassToType,
"RigidBody");
2287 lpChild->Load(oXml);
2296 if(lpChild)
delete lpChild;
2297 RELAY_ERROR(oError);
2302 if(lpChild)
delete lpChild;
2303 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
2321 std::string strType;
2349 RELAY_ERROR(oError);
2356 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
2373 THROW_ERROR(Al_Err_lOdorNotDefined, Al_Err_strOdorNotDefined);
2381 oError.
m_strError +=
" Duplicate odor type Key: " + lpOdor->
ID();
2382 RELAY_ERROR(oError);
2400 void RigidBody::RemoveOdor(std::string strID,
bool bThrowError)
2418 Odor *lpOdor = NULL;
2422 lpOdor =
new Odor(
this);
2433 if(lpOdor)
delete lpOdor;
2434 RELAY_ERROR(oError);
2439 if(lpOdor)
delete lpOdor;
2440 THROW_ERROR(Std_Err_lUnspecifiedError, Std_Err_strUnspecifiedError);
2464 m_lpPhysicsBody->Physics_AddBodyForceAtLocalPos(fltPx, fltPy, fltPz, fltFx, fltFy, fltFz, bScaleUnits);
2486 m_lpPhysicsBody->Physics_AddBodyForceAtWorldPos(fltPx, fltPy, fltPz, fltFx, fltFy, fltFz, bScaleUnits);
2504 m_lpPhysicsBody->Physics_AddBodyTorque(fltTx, fltTy, fltTz, bScaleUnits);
2521 CStdFPoint vLoc(0, 0, 0);
2597 float fltVolume = 0;
virtual float Magnus()
Gets the Magnus coefficient for the body.
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
The base class for all of the joint type of objects.
void AddRigidBody(RigidBody *lpBody)
Adds a new rigid body to the list of all bodies for this structure.
virtual float FoodEnergyContent()
Gets the food energy content.
IPhysicsBody * m_lpPhysicsBody
ContactSensor * m_lpContactSensor
virtual void ResetSimulation()
Resets the simulation back to time 0.
Base class file for all Animat simulation objects.
virtual CStdFPoint BuoyancyCenter()
Gets the relative position to the center of the buoyancy in the body.
virtual void PhysicsTimeStep(float fltVal)
Sets the integration time step for the physics engine.
virtual float StaticChildrenMass()
Gets the mass of all static children.
virtual void Initialize()
Initializes this object.
Declares the simulation recorder class.
float m_fltAngularVelocityDamping
The angular velocity damping for this part.
virtual bool IsCollisionObject()
Query if this object is collision object.
std::string m_strMaterialID
Identifier for the material type this part will use.
virtual void SetSystemPointers(Simulator *lpSim, Structure *lpStructure, NeuralModule *lpModule, Node *lpNode, bool bVerify)
Sets the system pointers.
virtual void DisableCollision(RigidBody *lpBody)
Disables collision between the past-in object and this object.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
virtual void Kill(bool bState=true)
Kills.
Simulator * m_lpMovableSim
The pointer to a Simulation.
virtual void CreateParts()
Allows the rigid body to create its parts using the chosen physics engine.
Root namespace for the base simulation library for AnimatLab.
virtual void EnableCollision(RigidBody *lpBody)
Enables collision between the past-in object and this object.
virtual float InverseMassUnits()
Gets the inverse mass units.
virtual void CreateChildJoints()
Loops through all the child parts of this rigid body and call CreateJoints.
virtual RigidBody * AddRigidBody(std::string strXml)
Creates and adds a rigid body.
virtual float FoodEaten()
Gets the amount of food eaten.
CStdFPoint m_vBuoyancyCenter
This is the relative position to the center of the buoyancy in the body.
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual CStdFPoint LinearDrag()
Gets the linear drag coefficients for the three axises for the body.
virtual void UpdateData()
Called to collect any body data for this part.
virtual float LinearVelocityDamping()
Gets the linear velocity damping for this body part.
Declares the body part class.
void RemoveRigidBody(std::string strID)
Removes the rigid body with the specified ID.
virtual bool RemoveItem(const std::string &strItemType, const std::string &strID, bool bThrowError=true)
Removes a child item from this parent.
virtual void RemoveContactSensor(std::string strID, bool bThrowError=true)
Removes the ContactSensor.
virtual float FoodQuantity()
Gets the food quantity.
virtual void UpdatePhysicsPosFromGraphics()
Updates the physics position from graphics.
std::string m_strError
The error message.
virtual void AddTorque(float fltTx, float fltTy, float fltTz, bool bScaleUnits)
Adds a torque to this body about its center.
virtual void LoadPosition(CStdXml &oXml)
Loads the items position.
virtual RigidBody * LoadRigidBody(CStdXml &oXml)
Loads a child rigid body.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
Simulator * m_lpSim
The pointer to a Simulation.
float m_fltEnabled
This is used for reporting the enabled state in a GetDataPointer call.
virtual bool HasStaticJoint()
Query if this object has a static joint.
virtual CStdFPoint Position()
Gets the local position. (m_oPosition)
Information about the standard error.
virtual std::string ID()
Gets the unique GUID ID of this object.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
void AddJoint(Joint *lpJoint)
Adds a new joint to the list of all joints for this structure.
virtual float BuoyancyScale()
Gets the scale used to calculate the buoyancy value.
virtual bool EnableFluids()
Query if this object has fluid interactions turned on.
virtual float GetMassValueWithStaticChildren()
Gets the mass of this part and all static children.
virtual float DenominatorDistanceUnits()
Gets the denominator distance units.
Class that stores information about types for QueryProperty information.
float m_fltMass
The mass of the object.
virtual bool FindCollisionExclusionBody(RigidBody *lpBody, bool bThrowError=true)
Searches the exclusion collision list to see if the specified part is already present.
virtual void Initialize()
Initializes this object.
virtual void Eat(float fltBiteSize, long lTimeSlice)
This item is eating the specified amount of food.
virtual float AngularVelocityDamping()
Gets the angular velocity damping.
virtual void DistanceUnits(std::string strUnits)
Sets the distance units.
virtual float GetDensity()
Gets the density of this part.
float m_fltVolume
The volume for the rigid body.
Declares the key frame class.
virtual void RemoveSurfaceContact(RigidBody *lpContactedSurface)
Decrements the surface contact count when this part stops colliding with something in the virtual wor...
virtual ~RigidBody()
Destructor.
float m_fltStickyOn
If this is a suction part then this controls when stickness is on.
bool Std_InValidRange(int iMinVal, int iMaxVal, int iVal, bool bThrowError, std::string strParamName)
Tests whether a number is within a valid range.
bool m_bFoodSource
Tells if this body is considered a food source.
float m_fltSurfaceContactCount
long m_lEatTime
Keeps track of how many time slices this part can eat.
virtual int VisualSelectionType()
Gets the visual selection type for this part.
virtual int GetTargetDataTypeIndex(const std::string &strDataType)
Used to convert a string target data type into an integer index.
virtual CStdFPoint CenterOfMassWithStaticChildren()
Gets the center of mass of this part with any static children added.
virtual bool ShuttingDown()
Tells whether the simulation is shutting down or not.
Declares the joint class.
virtual void AddSurfaceContact(RigidBody *lpContactedSurface)
Increments the surface contact count when this part collides with something in the virtual world...
Declares the organism class.
virtual bool SimRunning()
Gets whether the simulation is running.
virtual void RemoveCollisionExclusions()
Called by the desctructor. It removes this object from all other collision exclusion lists...
float m_fltFoodEnergyContent
The energy content of the food in calories.
bool m_bDisplayDebugCollisionGraphic
bool Std_IsAboveMin(int iMinVal, int iVal, bool bThrowError, std::string strParamName, bool bInclusiveLimit)
Tests if a number is above a minimum value.
AnimatSim::Environment::Structure * m_lpStructure
The pointer to this items parent Structure. If this is not relevant for this object then this is NULL...
std::string m_strID
The unique Id for this object.
std::string Std_Trim(std::string strVal)
Trims a string.
CStdFPoint m_vLinearDrag
This is the drag coefficients for the three axises for the body.
virtual float Density()
Gets the uniform density.
Declares the activated item class.
float m_fltMaxHydroForce
The maximum hyrdodynamic force that can be applied.
float m_fltReportVolume
The volume of the object to report to GUI.
virtual float DisplayMassUnits()
Gets the density mass units.
virtual CStdSerialize * CreateObject(std::string strModule, std::string strClassName, std::string strType, bool bThrowError=true)
Creates an object using a class factory.
virtual void UpdatePhysicsPosFromGraphics()
Updates the physics position from graphics.
bool m_bEnableFluids
true to enable fluid interactions.
Declares a light manager object.
virtual RigidBody * Child()
Gets the child RigidBody part for this joint.
virtual Odor * LoadOdor(CStdXml &oXml)
Loads an odor source.
IPhysicsMovableItem * m_lpPhysicsMovableItem
virtual float MaxHydroTorque()
Gets the maximum angular hydrodynamic torque that can be applied to this part.
float m_fltMaxHydroTorque
The maximum hyrdodynamic torque that can be applied.
float m_fltDensity
Uniform density for the rigid body.
Declares the bounding box class.
virtual bool HasStaticChildren()
Query if this rigid body has any static children.
float m_fltFoodReplenishRate
The rate at which food is replenished.
virtual CStdFPoint Position()
Gets the local position. (m_oPosition)
float m_fltReportDensity
The density value reported to the GUI.
virtual int FindChildListPos(std::string strID, bool bThrowError=true)
Finds the array index for the child part with the specified ID.
A standard xml manipulation class.
float m_fltMagnus
The Magnus coefficient for the body. This is defaulted to zero because it almost always negligble for...
virtual void StepSimulation()
Step the simulation for this object.
float m_fltReportMass
The mass of the object to report to GUI.
virtual CStdPtrArray< RigidBody > * ChildParts()
Gets the array of child parts.
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
virtual void AddOdor(Odor *lpOdor)
Adds an odor source to this body part.
virtual bool IsRoot()
Query if this is the root rigid body of the structure or not.
virtual bool Freeze()
Tells if this part is frozen or not.
virtual float GetVolume()
Gets the volume of this part.
virtual CStdFPoint GetVelocityAtPoint(float x, float y, float z)
Gets a velocity of this body at specified point in the body.
CStdPtrArray< RigidBody > m_aryChildParts
virtual std::string GetChildString(std::string strElementName)
Gets a string value from the element with the specified name.
virtual void Body(RigidBody *lpBody)
Sets the root body.
virtual void AddExternalNodeInput(int iTargetDataType, float fltInput)
Adds an external node input.
virtual bool SimulateHydrodynamics()
Gets whether the simulation uses hydrodynamics.
RigidBody * Parent()
Gets the parent RigidBody of this part.
virtual ContactSensor * GetContactSensor()
Gets the receptive field contact sensor.
bool Std_ToBool(int iVal)
Converts a value toa bool.
virtual void RemoveRigidBody(std::string strID, bool bThrowError=true)
Removes the rigid body with the specified ID.
virtual Joint * LoadJoint(CStdXml &oXml)
Loads a child joint.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
RigidBody * m_lpStickyChild
If we are doing a sticky lock then this is the child part that was locked on.
virtual bool GetChildBool(std::string strElementName)
Gets a bool value from the element with the specified name.
virtual CStdFPoint Position()
Gets the local position. (m_oPosition)
virtual float GetMass()
Gets the mass of this part.
virtual void AddForceAtLocalPos(float fltPx, float fltPy, float fltPz, float fltFx, float fltFy, float fltFz, bool bScaleUnits)
Adds a world-coordinate based force vector to this body at a specified local body position...
virtual void CreateChildParts()
Loops through all the child parts of this rigid body and call CreateParts.
virtual bool IsContactSensor()
Query if this object is contact sensor.
virtual bool IsStickyPart()
Query if this object acts as a sticky part. This only applies to contact sensors. If it is set to tru...
virtual int NumberOfChildren()
Gets the number of children of the current element.
float m_fltFoodQuantityInit
The initial food quantity to use when simulation is reset.
virtual CStdFPoint CenterOfMass()
Gets the user specified center of mass.
CStdFPoint m_vCenterOfMass
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
virtual bool AddItem(const std::string &strItemType, const std::string &strXml, bool bThrowError=true, bool bDoNotInit=false)
Adds a new object to this parent.
virtual void StepSimulation()
Step the simulation for this object.
float m_fltLinearVelocityDamping
The linear velocity damping for this body part.
CStdFPoint m_vAngularDrag
This is the drag coefficients for the three axises for the body.
float m_fltFoodQuantity
The quantity of food that this part contains.
virtual RigidBody * ParentWithCollisionGeometry()
Gets a parent that has collision geometry.
Declares the data chart manager class.
virtual Joint * JointToParent()
Gets the joint to parent.
Declares the rigid body class.
virtual float FoodReplenishRate()
Gets the food replenish rate.
virtual bool IntoChildElement(std::string strElementName, bool bThrowError=true)
Goes into the child element with the specified name.
virtual void StepSimulation()
Step the simulation for this object.
virtual float SurfaceContactCount()
Gets the surface contact count.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual void SimPausing()
Called just before the simulation pauses.
bool Std_LoadPoint(CStdXml &oXml, std::string strName, CStdIPoint &oPoint, bool bThrowError)
Standard load point.
std::unordered_set< RigidBody * > m_aryExcludeCollisionSet
This is the list of other parts that this part is excluded from colliding with.
Joint * m_lpJointToParent
virtual long TimeSlice()
Gets the current time slice.
Declares the structure class.
virtual void SetSurfaceContactCount(int iCount)
Direclty sets the surface contact count for when this part is contacting another rigid body part...
Declares the odor type class.
virtual void AddContactSensor(std::string strXml)
Creates and adds a ContactSensor.
virtual void AddForceAtWorldPos(float fltPx, float fltPy, float fltPz, float fltFx, float fltFy, float fltFz, bool bScaleUnits)
Adds a world-coordinate based force vector to this body at a specified world-coordinate body position...
virtual RigidBody * StickyChild()
Gets the child body part we are stuck to for a sticky part.
virtual std::string MaterialID()
Gets the material ID for this part.
virtual bool IsFoodSource()
Query if this object is food source.
virtual float InverseDistanceUnits()
Gets the inverse distance units.
virtual float StickyOn()
Query if this stickyness is turned on or not. This only applies to contact sensors that also have IsS...
Declares the simulator class.
CStdPtrMap< std::string, Odor > m_aryOdorSources
The array odor sources attached to this part.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
float m_fltMaxFoodQuantity
The maximum food quantity that this part can contain.
std::string Std_ToUpper(std::string strVal)
Converts a string to upper case.
float m_fltFoodEaten
Tells how much food is being eaten.
virtual float MaxFoodQuantity()
Gets the maximum food quantity.
Declares the activated item manager class.
virtual CStdFPoint AngularDrag()
Gets the angular drag coefficients for the three axises for the body.
Declares the external stimuli manager class.
bool m_bIsCollisionObject
This determines whether the object is a collision geometry object.
virtual float MaxHydroForce()
Gets the maximum linear hydrodynamic force that can be applied to this part.
The base class for all of the basic rigid body type of objects.
Declares the receptive field class.
virtual void Kill(bool bState=true)
Kills.
virtual void AfterResetSimulation()
Called after a simulation reset for some objects.
virtual float GetChildFloat(std::string strElementName)
Gets a float value from the element with the specified name.
RigidBody()
Default constructor.