4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
29 #ifndef PHY_IPHYSICSCONTROLLER_H
30 #define PHY_IPHYSICSCONTROLLER_H
32 #include "PHY_DynamicTypes.h"
37 PHY_IPhysicsController is the abstract simplified Interface to a physical object.
38 It contains the IMotionState and IDeformableMesh Interfaces.
40 class PHY_IPhysicsController
45 virtual ~PHY_IPhysicsController();
47 SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
49 virtual bool SynchronizeMotionStates(float time)=0;
51 WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
54 virtual void WriteMotionStateToDynamics(bool nondynaonly)=0;
55 virtual void WriteDynamicsToMotionState()=0;
56 // controller replication
57 virtual void PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl)=0;
60 virtual void RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local)=0;
61 virtual void RelativeRotate(const float drot[12],bool local)=0;
62 virtual void getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal)=0;
63 virtual void setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal)=0;
64 virtual void setPosition(float posX,float posY,float posZ)=0;
65 virtual void getPosition(PHY__Vector3& pos) const=0;
66 virtual void setScaling(float scaleX,float scaleY,float scaleZ)=0;
69 virtual void ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local)=0;
70 virtual void ApplyForce(float forceX,float forceY,float forceZ,bool local)=0;
71 virtual void SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local)=0;
72 virtual void SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local)=0;
73 virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ) = 0;
75 virtual void applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ)=0;
76 virtual void SetActive(bool active)=0;
78 // reading out information from physics
79 virtual void GetLinearVelocity(float& linvX,float& linvY,float& linvZ)=0;
80 virtual void GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ)=0;
81 virtual void getReactionForce(float& forceX,float& forceY,float& forceZ)=0;
83 // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted
84 virtual void setRigidBody(bool rigid)=0;
85 // clientinfo for raycasts for example
86 virtual void* getNewClientInfo()=0;
87 virtual void setNewClientInfo(void* clientinfo)=0;
88 virtual PHY_IPhysicsController* GetReplica() {return 0;}
90 virtual void calcXform() =0;
91 virtual void SetMargin(float margin) =0;
92 virtual float GetMargin() const=0;
93 virtual float GetRadius() const { return 0.f;}
94 PHY__Vector3 GetWorldPosition(PHY__Vector3& localpos);
98 #endif //PHY_IPHYSICSCONTROLLER_H