AnimatLab  2
Test
BlSpring.cpp
1 // BlSpring.cpp: implementation of the BlSpring class.
2 //
4 
5 #include "StdAfx.h"
6 #include "BlJoint.h"
7 #include "BlMotorizedJoint.h"
8 #include "BlRigidBody.h"
9 #include "BlLine.h"
10 #include "BlSpring.h"
11 #include "BlSimulator.h"
12 
13 namespace BulletAnimatSim
14 {
15  namespace Environment
16  {
17  namespace Bodies
18  {
19 
21 // Construction/Destruction
23 
24 BlSpring::BlSpring()
25 {
26  SetThisPointers();
27 }
28 
29 BlSpring::~BlSpring()
30 {
31  try
32  {
33  DeleteGraphics();
34  DeletePhysics(false);
35  }
36  catch(...)
37  {Std_TraceMsg(0, "Caught Error in desctructor of BlSpring/\r\n", "", -1, false, true);}
38 }
39 
41 {
42  Spring::CreateJoints();
43  BlLine::CreateParts();
44 
45  SetupPhysics();
46 }
47 
49 {
50  Spring::ResetSimulation();
51  BlLine::ResetSimulation();
52 }
53 
54 void BlSpring::AfterResetSimulation()
55 {
56  Spring::AfterResetSimulation();
57  BlLine::AfterResetSimulation();
58 }
59 
61 {
63  BlLine::StepSimulation(m_fltTension);
64 }
65 
66 
67  } //Joints
68  } // Environment
69 } //BulletAnimatSim
virtual void StepSimulation()
Step the simulation for this object.
Definition: BlSpring.cpp:60
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.
virtual void CreateJoints()
Allows the rigid body to create its joints using the chosen physics engine.
Definition: BlSpring.cpp:40
virtual void ResetSimulation()
Resets the simulation back to time 0.
Definition: BlSpring.cpp:48
virtual void CalculateTension()
Calculates the tension.
Definition: Spring.cpp:197
float m_fltTension
The current force being applied by the spring.
Definition: Spring.h:53