VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDiGuyMotionModel.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2020 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvDiGuy/vrvDiGuy.h>
13 #include <vrvCore/DtMotionModel.h>
14 #include <vlpi/exponentialSmoother.h>
15 #include <diguyMotionDirection.h>
16 #include <diguyMotionPosture.h>
17 #include <matrix/vlVector.h>
18 #include <map>
19 
20 class DtTaitBryan;
21 class diguyCharacterGuide;
22 
23 namespace makVrv
24 {
25 
26  class DtDe;
27  class DtModel;
28  class DtDiGuyCharacterModel;
29 
32  class DT_DLL_VRVDIGUY DtDiGuyMotionModel : public DtVRLDeadReckonerMotionModel<DtExponentialSmoother>
33  {
34  public:
35 
37  DtDiGuyMotionModel( DtDe& igs, DtSceneObject* owner );
38 
40  DtDiGuyMotionModel( const DtDiGuyMotionModel& orig, double time );
41 
43  virtual ~DtDiGuyMotionModel();
44 
46  virtual DtMotionModel* clone( double simTime );
47 
50  virtual bool motionModelHandlesUpdate() const;
51 
53  virtual void updateMotion( double simulationTime );
54  virtual void updateCharacterMotion( DtDiGuyCharacterModel* characterModel,
55  double simulationTime, bool needsTopoUpdate );
56 
58  virtual const char* getActionFromDescription( DtDiGuyCharacterModel* characterModel,
59  diguyMotionDirection direction, diguyMotionPosture posture, double actualSpeed );
60 
62  virtual void modelAdded( DtModel* );
63 
65  virtual void modelRemoved( DtModel* );
66 
68  virtual void setAll( const DtVector& loc, const DtVector32& vel, const DtTaitBryan& ori,
69  const DtVector32& acc, const DtVector32& rotVel, DtTime curTime );
70 
71  virtual void setLocation( const DtVector& loc, DtTime t );
72  virtual void setOrientation( const DtTaitBryan& ori, DtTime curTime );
73  virtual void setVelocity( const DtVector32& vel, DtTime curTime );
74  virtual void setRotationalVelocity( const DtVector32& vel, DtTime curTime );
75 
76  protected:
77 
78  //Calculate the direction Forward/Back/Left/Right
79  int calculateDirectionFBLR(const DtTaitBryan& ori, const DtVector32& vel);
80 
81  //Calculate the direction Forward/Back
82  int calculateDirectionFB(const DtTaitBryan& ori, const DtVector32& vel);
83 
85  void addCharacter( DtDiGuyCharacterModel* character );
86 
87  protected:
88 
90  {
92  : myLastDirection( DIGUY_MOTION_DIRECTION_NONE )
93  , myLastPosture( DIGUY_MOTION_POSTURE_UPRIGHT )
94  , myLastWeaponDeployed( false )
95  , myLastAction( NULL )
96  , myLastActionTime( 0.0 )
97  , myLastSpeed( 0.0 )
98  {
99  }
100 
104  const char* myLastAction;
106  double myLastSpeed;
107  };
108 
109  protected:
110 
112 
114 
115  typedef std::map<DtDiGuyCharacterModel*,CharacterUpdateInfoStruct*> CharacterInfoMap;
117 
118  // State update tracking variables.
119  // Used for all characters in the motion model.
121  DtTaitBryan myApproxOrientation;
126 
127  // These are the last known values to have come across the network.
128  // Used when running with smoothing disabled.
131  DtVector32 myLastFirmVelocity;
135  };
136 
137 
141  {
142  public:
143 
145  virtual ~DtDiGuyMotionModelCreator();
146 
148  virtual DtMotionModel* create(DtSceneObject* owner, DtDe& de);
149 
150  };
151 
152 }
DtSceneObject * mySceneObject
Definition: DtDiGuyMotionModel.h:113
Contains the makVrv::DtMotionModel class declaration.
DtVector myAcceleration
Definition: DtDiGuyMotionModel.h:123
DtVector myLastTopoUpdateLocation
Definition: DtDiGuyMotionModel.h:122
DtVector32 myLastFirmRotationalVelocity
Definition: DtDiGuyMotionModel.h:132
The base motion model class.
Definition: DtMotionModel.h:26
int myLastPosture
Definition: DtDiGuyMotionModel.h:102
const char * myLastAction
Definition: DtDiGuyMotionModel.h:104
DI-Guy Character model.
Definition: DtDiGuyCharacterModel.h:100
CharacterInfoMap myCharacters
Definition: DtDiGuyMotionModel.h:116
Contains DLL export macros.
DtTaitBryan myApproxOrientation
Definition: DtDiGuyMotionModel.h:121
bool myIsGeocentric
Definition: DtDiGuyMotionModel.h:124
DtTime myLastFirmRotationalVelocityTime
Definition: DtDiGuyMotionModel.h:133
DtVector32 myLastFirmVelocity
Definition: DtDiGuyMotionModel.h:131
CharacterUpdateInfoStruct()
Definition: DtDiGuyMotionModel.h:91
bool myOrientationChanged
Definition: DtDiGuyMotionModel.h:134
DtVector myLastFirmLocation
Definition: DtDiGuyMotionModel.h:129
int myLastDirection
Definition: DtDiGuyMotionModel.h:101
DtVRLDeadReckonerMotionModel extends DtMotionModel to use a VR-Link Dead Reckoner.
Definition: DtMotionModel.h:123
double myLastActionTime
Definition: DtDiGuyMotionModel.h:105
A DiGuy based motion model for objects which have a DI Guy character.
Definition: DtDiGuyMotionModel.h:32
bool myLastWeaponDeployed
Definition: DtDiGuyMotionModel.h:103
std::map< DtDiGuyCharacterModel *, CharacterUpdateInfoStruct * > CharacterInfoMap
Definition: DtDiGuyMotionModel.h:115
DtTaitBryan myLastFirmOrientation
Definition: DtDiGuyMotionModel.h:130
bool myNeedsInit
Definition: DtDiGuyMotionModel.h:125
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition: DtSceneObject.h:41
A model which owns a single model instance.
Definition: DtModel.h:55
DtDe & myDe
Definition: DtDiGuyMotionModel.h:111
DtVector myApproxLocation
Definition: DtDiGuyMotionModel.h:120
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
#define DT_DLL_VRVDIGUY
Definition: vrvDiGuy.h:21
double myLastSpeed
Definition: DtDiGuyMotionModel.h:106
Creator for makVrv::DtDiGuyMotionModel.
Definition: DtDiGuyMotionModel.h:140
The motion model.
Definition: DtMotionModel.h:307

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)