28 #ifndef HPL_PHYSICS_CONTROLLER_H 29 #define HPL_PHYSICS_CONTROLLER_H 31 #include "hpl1/engine/math/MathTypes.h" 32 #include "hpl1/engine/math/PidController.h" 33 #include "hpl1/engine/math/Spring.h" 35 #include "hpl1/engine/game/SaveGame.h" 41 enum ePhysicsControllerType {
42 ePhysicsControllerType_Pid,
43 ePhysicsControllerType_Spring,
44 ePhysicsControllerType_LastEnum
49 enum ePhysicsControllerInput {
50 ePhysicsControllerInput_JointAngle,
51 ePhysicsControllerInput_JointDist,
52 ePhysicsControllerInput_LinearSpeed,
53 ePhysicsControllerInput_AngularSpeed,
54 ePhysicsControllerInput_LastEnum
59 enum ePhysicsControllerOutput {
60 ePhysicsControllerOutput_Force,
61 ePhysicsControllerOutput_Torque,
62 ePhysicsControllerOutput_LastEnum
67 enum ePhysicsControllerAxis {
68 ePhysicsControllerAxis_X,
69 ePhysicsControllerAxis_Y,
70 ePhysicsControllerAxis_Z,
71 ePhysicsControllerAxis_LastEnum
76 enum ePhysicsControllerEnd {
77 ePhysicsControllerEnd_Null,
78 ePhysicsControllerEnd_OnDest,
79 ePhysicsControllerEnd_OnMin,
80 ePhysicsControllerEnd_OnMax,
81 ePhysicsControllerEnd_LastEnum
86 kSaveData_BaseClass(iPhysicsController) {
87 kSaveData_ClassInit(iPhysicsController) public : tString msName;
98 bool mbMulMassWithOutput;
107 tString msNextController;
112 iSaveObject *CreateSaveObject(cSaveObjectHandler * apSaveObjectHandler, cGame * apGame) {
return NULL; }
113 int GetSaveCreatePrio() {
return 0; }
129 void Update(
float afTimeStep);
131 const tString &GetName() {
return msName; }
138 bool IsActive() {
return mbActive; }
139 void SetActive(
bool abX);
144 void SetA(
float afA) { mfA = afA; }
148 void SetB(
float afB) { mfB = afB; }
152 void SetC(
float afC) { mfC = afC; }
154 void SetPidIntegralSize(
int alSize);
156 void SetType(ePhysicsControllerType aType) { mType = aType; }
158 void SetDestValue(
float afX) { mfDestValue = afX; }
159 float GetDestValue() {
return mfDestValue; }
161 void SetMaxOutput(
float afX) { mfMaxOutput = afX; }
163 void SetInputType(ePhysicsControllerInput aInput, ePhysicsControllerAxis aAxis) {
168 void SetOutputType(ePhysicsControllerOutput aOutput, ePhysicsControllerAxis aAxis) {
169 mOutputType = aOutput;
172 void SetMulMassWithOutput(
bool abX) { mbMulMassWithOutput = abX; }
174 void SetEndType(ePhysicsControllerEnd aEnd) { mEndType = aEnd; }
175 ePhysicsControllerEnd GetEndType() {
return mEndType; }
177 void SetNextController(
const tString &asName) { msNextController = asName; }
178 const tString &GetNextController() {
return msNextController; }
180 void SetLogInfo(
bool abX) { mbLogInfo = abX; }
182 void SetPaused(
bool abX) { mbPaused = abX; }
184 static bool mbUseInputMatrixFix;
193 cVector3f GetInputValue(ePhysicsControllerInput aInput);
194 float GetOutputValue(
float afError,
float afInput,
float afTimeStep);
195 void AddOutputValue(ePhysicsControllerOutput aOutput, ePhysicsControllerAxis aAxis,
197 float GetAxisValue(ePhysicsControllerAxis aAxis,
const cVector3f &avVec);
210 bool mbMulMassWithOutput;
212 ePhysicsControllerType mType;
214 ePhysicsControllerInput mInputType;
215 ePhysicsControllerAxis mInputAxis;
217 ePhysicsControllerOutput mOutputType;
218 ePhysicsControllerAxis mOutputAxis;
220 ePhysicsControllerEnd mEndType;
234 #endif // HPL_PHYSICS_CONTROLLER_H
virtual void LoadFromSaveData(iSaveData *apSaveData)
Definition: PhysicsWorld.h:115
Definition: SaveGame.h:130
virtual void SaveToSaveData(iSaveData *apSaveData)
Definition: PhysicsBody.h:117
Definition: SaveGame.h:111
virtual iSaveData * CreateSaveData()
Definition: PhysicsController.h:122
virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
Definition: PhysicsJoint.h:135
Definition: SaveGame.h:183