28 #ifndef HPL_PHYSICS_BODY_H 29 #define HPL_PHYSICS_BODY_H 31 #include "hpl1/engine/graphics/GraphicsTypes.h" 32 #include "hpl1/engine/scene/Entity3D.h" 38 class iPhysicsMaterial;
39 class iLowLevelGraphics;
43 class cPhysicsContactData;
77 bool mbCollideCharacter;
81 float mfLinearDamping;
82 float mfAngularDamping;
83 float mfMaxLinearSpeed;
84 float mfMaxAngularSpeed;
90 bool mbContinuousCollision;
97 virtual int GetSaveCreatePrio();
104 mfLinearViscosity(1), mfAngularViscosity(1) {}
109 float mfLinearViscosity;
110 float mfAngularViscosity;
139 virtual void SetLinearVelocity(
const cVector3f &avVel) = 0;
140 virtual cVector3f GetLinearVelocity()
const = 0;
141 virtual void SetAngularVelocity(
const cVector3f &avVel) = 0;
142 virtual cVector3f GetAngularVelocity()
const = 0;
143 virtual void SetLinearDamping(
float afDamping) = 0;
144 virtual float GetLinearDamping()
const = 0;
145 virtual void SetAngularDamping(
float afDamping) = 0;
146 virtual float GetAngularDamping()
const = 0;
147 virtual void SetMaxLinearSpeed(
float afSpeed) = 0;
148 virtual float GetMaxLinearSpeed()
const = 0;
149 virtual void SetMaxAngularSpeed(
float afDamping) = 0;
150 virtual float GetMaxAngularSpeed()
const = 0;
151 virtual cMatrixf GetInertiaMatrix() = 0;
155 virtual void SetMass(
float afMass) = 0;
156 virtual float GetMass()
const = 0;
157 virtual void SetMassCentre(
const cVector3f &avCentre) = 0;
158 virtual cVector3f GetMassCentre()
const = 0;
160 virtual void AddForce(
const cVector3f &avForce) = 0;
161 virtual void AddForceAtPosition(
const cVector3f &avForce,
const cVector3f &avPos) = 0;
162 virtual void AddTorque(
const cVector3f &avTorque) = 0;
163 virtual void AddImpulse(
const cVector3f &avImpulse) = 0;
164 virtual void AddImpulseAtPosition(
const cVector3f &avImpulse,
const cVector3f &avPos) = 0;
166 virtual void SetEnabled(
bool abEnabled) = 0;
167 virtual bool GetEnabled()
const = 0;
168 virtual void SetAutoDisable(
bool abEnabled) = 0;
169 virtual bool GetAutoDisable()
const = 0;
171 virtual void SetAutoDisableLinearThreshold(
float afThresold) = 0;
172 virtual float GetAutoDisableLinearThreshold()
const = 0;
173 virtual void SetAutoDisableAngularThreshold(
float afThresold) = 0;
174 virtual float GetAutoDisableAngularThreshold()
const = 0;
175 virtual void SetAutoDisableNumSteps(
int alNum) = 0;
176 virtual int GetAutoDisableNumSteps()
const = 0;
178 virtual void SetContinuousCollision(
bool abOn) = 0;
179 virtual bool GetContinuousCollision() = 0;
181 virtual void SetGravity(
bool abEnabled) = 0;
182 virtual bool GetGravity()
const = 0;
186 void UpdateBeforeSimulate(
float afTimeStep);
187 void UpdateAfterSimulate(
float afTimeStep);
191 void SetBlocksSound(
bool abX) { mbBlocksSound = abX; }
192 bool GetBlocksSound() {
return mbBlocksSound; }
194 void SetBlocksLight(
bool abX) { mbBlocksLight = abX; }
195 bool GetBlocksLight() {
return mbBlocksLight; }
197 void SetScrapeSoundEntity(
cSoundEntity *apEntity) { mpScrapeSoundEntity = apEntity; }
198 cSoundEntity *GetScrapeSoundEntity() {
return mpScrapeSoundEntity; }
199 void SetScrapeBody(
iPhysicsBody *apBody) { mpScrapeBody = apBody; }
201 const cMatrixf &GetPreveScrapeMatrix() {
return m_mtxPrevScrapeMatrix; }
202 void SetPreveScrapeMatrix(
const cMatrixf &a_mtxMtx) { m_mtxPrevScrapeMatrix = a_mtxMtx; }
204 void SetRollSoundEntity(
cSoundEntity *apEntity) { mpRollSoundEntity = apEntity; }
205 cSoundEntity *GetRollSoundEntity() {
return mpRollSoundEntity; }
207 void SetHasImpact(
bool abX) { mbHasImpact = abX; }
208 bool HasImpact() {
return mbHasImpact; }
209 void SetHasSlide(
bool abX) { mbHasSlide = abX; }
210 bool HasSlide() {
return mbHasSlide; }
212 bool HasCollision() {
return mbHasCollision; }
214 void SetUserData(
void *apUserData) { mpUserData = apUserData; }
215 void *GetUserData() {
return mpUserData; }
223 void SetCollide(
bool abX) { mbCollide = abX; }
224 bool GetCollide() {
return mbCollide; }
226 void SetIsCharacter(
bool abX) { mbIsCharacter = abX; }
227 bool IsCharacter() {
return mbIsCharacter; }
229 void SetCollideCharacter(
bool abX) { mbCollideCharacter = abX; }
230 bool GetCollideCharacter() {
return mbCollideCharacter; }
232 void SetCharacterBody(
iCharacterBody *apCharBody) { mpCharacterBody = apCharBody; }
235 void SetIsRagDoll(
bool abX) { mbIsRagDoll = abX; }
236 bool IsRagDoll() {
return mbIsRagDoll; }
238 void SetCollideRagDoll(
bool abX) { mbCollideRagDoll = abX; }
239 bool GetCollideRagDoll() {
return mbCollideRagDoll; }
241 void SetVolatile(
bool abX) { mbVolatile = abX; }
242 bool IsVolatile() {
return mbVolatile; }
244 void SetPushedByCharacterGravity(
bool abX) { mbPushedByCharacterGravity = abX; }
245 bool GetPushedByCharacterGravity() {
return mbPushedByCharacterGravity; }
247 void SetBuoyancyId(
int alX) { mlBuoyancyId = alX; }
248 void SetBuoyancyActive(
bool abX) { mBuoyancy.mbActive = abX; }
249 void SetBuoyancyDensity(
float afX) { mBuoyancy.mfDensity = afX; }
250 void SetBuoyancyLinearViscosity(
float afX) { mBuoyancy.mfLinearViscosity = afX; }
251 void SetBuoyancyAngularViscosity(
float afX) { mBuoyancy.mfAngularViscosity = afX; }
252 void SetBuoyancySurface(
const cPlanef &aP) { mBuoyancy.mSurface = aP; }
254 int GetBuoyancyId() {
return mlBuoyancyId; }
255 bool GetBuoyancyActive() {
return mBuoyancy.mbActive; }
256 float GetBuoyancyDensity() {
return mBuoyancy.mfDensity; }
257 float GetBuoyancyLinearViscosity() {
return mBuoyancy.mfLinearViscosity; }
258 float GetBuoyancyAngularViscosity() {
return mBuoyancy.mfAngularViscosity; }
259 cPlanef SetBuoyancySurface() {
return mBuoyancy.mSurface; }
261 void SetCanAttachCharacter(
bool abX) { mbCanAttachCharacter = abX; }
262 bool GetCanAttachCharacter() {
return mbCanAttachCharacter; }
268 void DisableAfterSimulation() { mbDisableAfterSimulation =
true; }
271 tString GetEntityType() {
return "Body"; }
275 virtual void SaveToSaveData(
iSaveData *apSaveData);
276 virtual void LoadFromSaveData(
iSaveData *apSaveData);
279 virtual void DeleteLowLevel() = 0;
304 bool mbPushedByCharacterGravity;
309 bool mbCollideCharacter;
311 bool mbCollideRagDoll;
314 bool mbCanAttachCharacter;
319 bool mbDisableAfterSimulation;
323 tPhysicsBodyCallbackList mlstBodyCallbacks;
332 #endif // HPL_PHYSICS_BODY_H
Definition: PhysicsWorld.h:115
Definition: BoundingVolume.h:71
Definition: SerializeClass.h:230
Definition: PhysicsBody.h:102
Definition: SaveGame.h:130
Definition: PhysicsBody.h:49
Definition: CollideShape.h:50
Definition: PhysicsBody.h:117
Definition: SaveGame.h:111
Definition: Container.h:219
Definition: PhysicsMaterial.h:77
Definition: CharacterBody.h:153
Definition: Entity3D.h:81
Definition: list_intern.h:51
Definition: SoundEntity.h:86
Definition: PhysicsJoint.h:135
Definition: SaveGame.h:183
Definition: LowLevelGraphics.h:200
Definition: PhysicsBody.h:62