Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/physics/Body.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _BODY_H_
00004 #define _BODY_H_
00005 
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 #include <scene/Node.h>
00009 
00010 #include <string>
00011 
00012 namespace physics
00013 {
00014 
00015 class Material;
00016 class BodyData;
00017 enum BodyType;
00018 
00022 class ENGINE_PUBLIC_EXPORT Body: public scene::Node
00023 {
00024 public:
00025 
00026         Body(BodyData* bodyData);
00027         Body(const std::string& name, BodyData* bodyData);
00028 
00029         virtual ~Body();
00030 
00031         void setBodyType(BodyType type);
00032         BodyType getBodyType();
00033 
00035         void setBodyData(const std::string& filename);
00036         void setBodyData(BodyData* bodyData);
00037 
00038         BodyData* getBodyData() const;
00039 
00041         virtual void setMaterial(const std::string& filename);
00042         virtual void setMaterial(Material* material);
00043 
00044         Material* getMaterial() const;
00045 
00047         virtual void setEnabled(bool enabled);
00048 
00050         bool isEnabled() const;
00051 
00053         void setSleeping(bool sleeping);
00054 
00056         bool isSleeping() const;
00057 
00059         void setSleepiness(f32 sleepiness);
00060 
00062         f32 getSleepiness() const;
00063 
00065         void setMass(f32 mass);
00067         f32 getMass() const;
00068 
00070         void setLinearDamping(f32 linearDamping);
00071 
00073         f32 getLinearDamping() const;
00074 
00076         void setAngularDamping(f32 angularDamping);
00077 
00079         f32 getAngularDamping() const;
00080 
00082         void setLinearVelocity(const core::vector3d& velocity);
00083 
00085         const core::vector3d getLinearVelocity();
00086 
00088         void setAngularVelocity(const core::vector3d& velocity);
00089         
00091         const core::vector3d getAngularVelocity();
00092 
00095         virtual void applyForce(const core::vector3d& force);
00096 
00099         virtual void applyTorque(const core::vector3d& torque);
00100 
00104         virtual void applyLinearImpulse(const core::vector3d& linearImpulse);
00105 
00108         virtual void applyAngularImpulse(const core::vector3d& angularImpulse);
00109 
00110 protected:
00111 
00112         // Incremented count for next index
00113         static u32 msNextGeneratedActorIndex;
00114 
00115         void initProperties();
00116         void copyProperties();
00117 
00118         virtual void initializeImpl();
00119         virtual void updateTransformImpl();
00120 
00121         BodyData* mBodyData;
00122 
00124         BodyType mBodyType;
00125 
00127         bool mSleeping;
00128 
00130         f32 mSleepiness;
00131 
00133         f32 mMass;
00134 
00136         f32 mLinearDamping;
00137 
00139         f32 mAngularDamping;
00140 
00142         core::vector3d mLinearVelocity;
00143 
00145         core::vector3d mAngularVelocity;
00146 
00148         Material* mMaterial;
00149 
00151         bool mEnabled;
00152 
00153         core::vector3d mForce;
00154         core::vector3d mTorque;
00155         core::vector3d mLinearImpulse;
00156         core::vector3d mAngularImpulse;
00157 };
00158 
00159 } // end namespace physics
00160 
00161 #endif

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)