VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtGroundClampingUpdater.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 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 
25  {
26  public:
27 
30  {
31  ClampNone = 0,
32  ClampOrientation = 1,
33  ClampPosition = 2,
34  ClampUpright = 4,
35  ClampOrientationAndPosition = ClampOrientation | ClampPosition,
36  ClampOrientationAndUpright = ClampOrientation | ClampUpright,
37  ClampPositionAndUpright = ClampPosition | ClampUpright,
38  ClampAll = ClampOrientation | ClampPosition | ClampUpright
39  };
40 
41  public:
42 
45 
47  virtual ~DtGroundClampingUpdater();
48 
50  virtual void update( DtTime tNow );
51 
54  virtual void setEnabled(bool enabled);
55 
57  virtual void setMode(GroundClampingMode mode);
58 
60  bool isClamping() const;
61 
63  inline bool isClampingUp() const
64  {
65  return myMode & ClampUpright;
66  }
67 
69  inline bool isClampingOrientation() const
70  {
71  return myMode & ClampOrientation;
72  }
73 
75  inline bool isClampingPosition() const
76  {
77  return myMode & ClampPosition;
78  }
79 
87  virtual void setCullCylinderRadiusScale(float scale);
88 
90  virtual void setClampAlways(bool enabled);
91 
93  virtual void setCheckForCulling(bool);
94 
97  virtual void doGroundClamp( DtTime tNow );
98 
101  virtual void setClampTimeThreshold(double);
102 
103  protected:
104 
106  static void computePerpendicularRotation( const DtVector& pos,
107  const DtVector& hitNormal, const DtTaitBryan& orientation,
108  DtTaitBryan& output );
109 
113  bool computeGroundClampingHit(const DtVector& up,const DtVector& unclampedPosition, DtVector& hitLocation, DtVector& hitNormal);
114 
116  void computeIntersectionOrigin(const DtVector& up, const DtVector& unclampedPosition, DtVector& origin) const;
117 
119  bool needClampThisTick() const;
120 
123  bool targetIsMoving( const DtVector& newPos, const DtVector& lastPos ) const;
124 
127  bool targetIsTurning( const DtTaitBryan& newOri, const DtTaitBryan& lastOri ) const;
128 
130  bool checkCulling(const DtVector& up) const;
131 
132  void clampToWater( DtTime tNow );
133 
134  // handy helper func to determine the delta between circle angles,
136  static double angleDifference( double prev, double curr );
137 
138  protected:
139 
140  static const double theClampTimeThreshold;
141  static const double theMaxCacheInterval;
142  static const double theClampDistThreshold;
143  static const double theClampOrientThreshold;
144  static const double theIsectLength;
145 
150 
153 
156 
159 
163 
166 
169 
172 
175 
178 
181 
184  };
185 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)