VR-Forces 4.1.1 Class Documentation
DtGroundClampingUpdater.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
12 #include <matrix/vlVector.h>
13 #include <matrix/vlTaitBryan.h>
14 
15 namespace makVrv
16 {
17  class DtIntersectionCache;
18 
24  {
25  public:
26 
29  {
30  ClampNone = 0,
31  ClampOrientation = 1,
32  ClampPosition = 2,
33  ClampUpright = 4,
34  ClampOrientationAndPosition = ClampOrientation | ClampPosition,
35  ClampOrientationAndUpright = ClampOrientation | ClampUpright,
36  ClampPositionAndUpright = ClampPosition | ClampUpright,
37  ClampAll = ClampOrientation | ClampPosition | ClampUpright
38  };
39 
40  public:
41 
43  DtGroundClampingUpdater(DtDe& de, DtUniqueID id, bool suppressTick = false );
44 
46  virtual ~DtGroundClampingUpdater();
47 
49  virtual void update( DtTime tNow );
50 
52  virtual void setPosition(const DtVector& position);
53 
55  virtual void setOrientation(const DtTaitBryan& ori);
56 
59  virtual void setPosition(int index, const DtVector&);
60 
63  virtual void setOrientation(int index, const DtTaitBryan&);
64 
66  virtual void removeSpatial(int);
67 
69  virtual void resetToUnclamped();
70 
73  virtual void setEnabled(bool enabled);
74 
76  virtual void setMode(GroundClampingMode mode);
77 
79  bool isClamping() const;
80 
82  inline bool isClampingUp() const
83  {
84  return myMode & ClampUpright;
85  }
86 
88  inline bool isClampingOrientation() const
89  {
90  return myMode & ClampOrientation;
91  }
92 
94  inline bool isClampingPosition() const
95  {
96  return myMode & ClampPosition;
97  }
98 
106  virtual void setCullCylinderRadiusScale(float scale);
107 
109  virtual void setClampAlways(bool enabled);
110 
112  virtual void setCheckForCulling(bool);
113 
116  virtual bool doGroundClamp();
117 
120  virtual void setClampTimeThreshold(double);
121 
122  protected:
123 
125  static void computePerpendicularRotation( const DtVector& pos,
126  const DtVector& hitNormal, const DtTaitBryan& orientation,
127  DtTaitBryan& output );
128 
132  bool computeGroundClampingHit(const DtVector& up,const DtVector& unclampedPosition, DtVector& hitLocation, DtVector& hitNormal);
133 
135  void computeIntersectionOrigin(const DtVector& up, const DtVector& unclampedPosition, DtVector& origin) const;
136 
138  bool needClampThisTick() const;
139 
142  bool targetIsMoving( const DtVector& newPos, const DtVector& lastPos ) const;
143 
146  bool targetIsTurning( const DtTaitBryan& newOri, const DtTaitBryan& lastOri ) const;
147 
149  bool checkCulling(const DtVector& up) const;
150 
151  // handy helper func to determine the delta between circle angles,
153  static double angleDifference( double prev, double curr );
154 
155  protected:
156 
157  static const double theClampTimeThreshold;
158  static const double theMaxCacheInterval;
159  static const double theClampDistThreshold;
160  static const double theClampOrientThreshold;
161  static const double theIsectLength;
162 
163  typedef std::vector<DtVector> Positions;
164  typedef std::vector<DtTaitBryan> Orientations;
165 
168 
171 
174 
178 
181 
184 
187 
190 
193 
196 
199  };
200 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)