AnimatLab  2
Test
VsStructure.cpp
Go to the documentation of this file.
1 
7 #include "StdAfx.h"
8 #include "VsMovableItem.h"
9 #include "VsBody.h"
10 #include "VsJoint.h"
11 #include "VsMotorizedJoint.h"
12 #include "VsRigidBody.h"
13 #include "VsStructure.h"
14 #include "VsSimulator.h"
15 #include "VsDragger.h"
16 
17 namespace VortexAnimatSim
18 {
19  namespace Environment
20  {
21 
29 {
30  m_lpVsBody = NULL;
31  SetThisPointers();
32 }
33 
41 {
42  m_lpAssembly = NULL;
43 }
44 
45 void VsStructure::Body(RigidBody *lpBody)
46 {
47  Structure::Body(lpBody);
48  m_lpVsBody = dynamic_cast<VsRigidBody *>(lpBody);
49 
50  if(!m_lpVsBody)
51  THROW_TEXT_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody, "ID: " + lpBody->Name());
52 }
53 
54 void VsStructure::SetThisPointers()
55 {
56  VsMovableItem::SetThisPointers();
57 
58  m_lpThisST = dynamic_cast<Structure *>(this);
59  if(!m_lpThisST)
60  THROW_TEXT_ERROR(Vs_Err_lThisPointerNotDefined, Vs_Err_strThisPointerNotDefined, "m_lpThisST, " + m_lpThisAB->Name());
61 }
62 
63 osg::Group *VsStructure::ParentOSG()
64 {
65  return GetVsSimulator()->OSGRoot();
66 }
67 
68 void VsStructure::Create()
69 {
70  CreateItem();
71 
72  Structure::Create();
73 }
74 
75 void VsStructure::SetupPhysics()
76 {
77 }
78 
80 {
81  VsMovableItem::Physics_ResetSimulation();
82 
83  Structure::ResetSimulation();
84 }
85 
86 void VsStructure::UpdatePositionAndRotationFromMatrix()
87 {
88  VsMovableItem::UpdatePositionAndRotationFromMatrix();
89 
90  if(m_lpVsBody)
91  m_lpVsBody->EndGripDrag();
92 }
93 
94  } // Environment
95 } //VortexAnimatSim
A common class for all rigid body data specific to vortex.
Definition: VsRigidBody.h:55
virtual void ResetSimulation()
Resets the simulation back to time 0.
Definition: VsStructure.cpp:79
virtual RigidBody * Body()
Gets the root body.
Definition: Structure.cpp:115
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
Structure()
Default constructor.
Definition: Structure.cpp:53
Declares the vortex structure class.