6 #include "VsMovableItem.h"
9 #include "VsMotorizedJoint.h"
10 #include "VsRigidBody.h"
13 #include "VsSimulator.h"
14 #include "VsDragger.h"
41 {
Std_TraceMsg(0,
"Caught Error in desctructor of VsSpring/\r\n",
"", -1,
false,
true);}
46 Spring::NaturalLength(fltVal, bUseScaling);
53 Spring::Stiffness(fltVal, bUseScaling);
60 Spring::Damping(fltVal, bUseScaling);
67 Spring::InitializeAttachments();
71 void VsSpring::Physics_Resize()
73 VsRigidBody::Physics_Resize();
77 void VsSpring::DeletePhysics()
82 if(GetVsSimulator() && GetVsSimulator()->Universe())
84 GetVsSimulator()->Universe()->removeConstraint(m_vxSpring);
91 void VsSpring::SetupPhysics()
101 if(!lpPrimaryAttachment && !lpSecondaryAttachment)
110 if(!lpVsPrimary && !lpVsSecondary)
118 CStdFPoint vPrimPos = lpPrimaryAttachment->AbsolutePosition();
119 CStdFPoint vSecPos = lpSecondaryAttachment->AbsolutePosition();
121 m_vxSpring->setPartAttachmentPosition(0, vPrimPos.x, vPrimPos.y, vPrimPos.z);
122 m_vxSpring->setPartAttachmentPosition(1, vSecPos.x, vSecPos.y, vSecPos.z);
125 GetVsSimulator()->Universe()->addConstraint(m_vxSpring);
133 Spring::CreateJoints();
134 VsLine::CreateParts();
141 Spring::Enabled(bVal);
146 m_vxSpring->EnableBodies();
150 void VsSpring::Physics_CollectData()
167 Spring::ResetSimulation();
168 VsLine::ResetSimulation();
171 void VsSpring::AfterResetSimulation()
173 Spring::AfterResetSimulation();
174 VsLine::AfterResetSimulation();
179 Spring::StepSimulation();
virtual float Damping()
Gets the damping of the spring.
virtual float CalculateLength()
Calculates the length of the line.
float m_fltStiffness
The stiffness of the spring.
virtual float NaturalLength()
Gets the natural length of the spring.
float m_fltNaturalLength
The natural length of the spring.
float m_fltDamping
The damping of the spring.
A common class for all rigid body data specific to vortex.
virtual void ResetSimulation()
Resets the simulation back to time 0.
virtual void InitializeAttachments()
Initializes the attachments.
virtual bool Enabled()
Tells whether this node is enabled.
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
virtual void StepSimulation()
Step the simulation for this object.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
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.
CStdArray< Attachment * > m_aryAttachmentPoints
A pointer to the primary attachment part.
virtual float Stiffness()
Gets the stiffness of the spring.
bool m_bEnabled
Tells if this item is enabled or not. If it is not enabled then it is not run.
float m_fltEnergy
The current energy contained in the spring.
float m_fltStiffnessNotScaled
The unscaled stiffness. This is used to calcuate the energy.
float m_fltLength
Current length of the line.
float m_fltDisplacement
The current displacement of the spring from its natural length.
float m_fltNaturalLengthNotScaled
The unscaled natural length. This is used to calcuate the tension and displacement.
float m_fltTension
The current force being applied by the spring.