Changeset 1702


Ignore:
Timestamp:
Aug 7, 2012, 2:12:33 PM (8 years ago)
Author:
touky
Message:

Skeleton for EasyCharacterController

Location:
trunk/test/Physics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Physics/EasyPhysics.cpp

    r1698 r1702  
    198198}
    199199
     200//Remove Physic object to the simulation
    200201void EasyPhysic::RemoveFromSimulation(class Simulation* current_simulation)
    201202{
     
    238239
    239240//-------------------------------------------------------------------------
     241//EASY_CHARACTER_CONTROLLER
     242//--
     243
     244void EasyCharacterController::SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation)
     245{
     246
     247}
     248void EasyCharacterController::SetMass(float mass)
     249{
     250
     251}
     252void EasyCharacterController::InitBodyToRigid(bool ZeroMassIsKinematic)
     253{
     254
     255}
     256void EasyCharacterController::InitBodyToGhost()
     257{
     258        //btCollisionObject::CF_CHARACTER_OBJECT
     259}
     260void EasyCharacterController::AddToSimulation(class Simulation* current_simulation)
     261{
     262
     263}
     264void EasyCharacterController::RemoveFromSimulation(class Simulation* current_simulation)
     265{
     266
     267}
     268mat4 EasyCharacterController::GetTransform()
     269{
     270        mat4(1.f);
     271}
     272
     273//-------------------------------------------------------------------------
    240274//EASY_CONSTRAINT
    241275//--
  • trunk/test/Physics/EasyPhysics.h

    r1698 r1702  
    4242        ~EasyPhysic();
    4343
    44         void SetShapeToBox(lol::vec3& box_size);
    45         void SetShapeToSphere(float radius);
    46         void SetShapeToCone(float radius, float height);
    47         void SetShapeToCylinder(lol::vec3& cyl_size);
    48         void SetShapeToCapsule(float radius, float height);
    49 
    50         bool CanChangeCollisionChannel() { return (m_rigid_body == NULL); }
    51         void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
    52         void SetMass(float mass);
    53         void InitBodyToRigid(bool ZeroMassIsKinematic=false);
    54         void InitBodyToGhost();
    55         void AddToSimulation(class Simulation* current_simulation);
    56         void RemoveFromSimulation(class Simulation* current_simulation);
    57         mat4 GetTransform();
     44        virtual void SetShapeToBox(lol::vec3& box_size);
     45        virtual void SetShapeToSphere(float radius);
     46        virtual void SetShapeToCone(float radius, float height);
     47        virtual void SetShapeToCylinder(lol::vec3& cyl_size);
     48        virtual void SetShapeToCapsule(float radius, float height);
     49
     50        virtual bool CanChangeCollisionChannel() { return (m_rigid_body == NULL); }
     51        virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
     52        virtual void SetMass(float mass);
     53        virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false);
     54        virtual void InitBodyToGhost();
     55        virtual void AddToSimulation(class Simulation* current_simulation);
     56        virtual void RemoveFromSimulation(class Simulation* current_simulation);
     57        virtual mat4 GetTransform();
    5858
    5959protected:
    60         void SetLocalInertia(float mass);
    61         void SetShapeTo(btCollisionShape* collision_shape);
     60        virtual void SetLocalInertia(float mass);
     61        virtual void SetShapeTo(btCollisionShape* collision_shape);
    6262
    6363        btCollisionObject*                                                      m_collision_object;
     
    7676        EasyPhysic() { }
    7777
    78         void SetShapeToBox(lol::vec3& BoxSize) { }
    79         void SetShapeToSphere(float radius) { }
    80         void SetShapeToCone(float radius, float height) { }
    81         void SetShapeToCylinder(lol::vec3& cyl_size) { }
    82         void SetShapeToCapsule(float radius, float height) { }
    83 
    84         bool CanChangeCollisionChannel() { return true; }
    85         void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
    86         void SetMass(float mass) { }
    87         void InitBodyToRigid() { }
    88         void InitBodyToGhost() { }
    89         void AddToSimulation(class Simulation* current_simulation) { }
    90         void RemoveFromSimulation(class Simulation* current_simulation) { }
    91         mat4 GetTransform() { return mat4(1.0f); }
     78        virtual void SetShapeToBox(lol::vec3& BoxSize) { }
     79        virtual void SetShapeToSphere(float radius) { }
     80        virtual void SetShapeToCone(float radius, float height) { }
     81        virtual void SetShapeToCylinder(lol::vec3& cyl_size) { }
     82        virtual void SetShapeToCapsule(float radius, float height) { }
     83
     84        virtual bool CanChangeCollisionChannel() { return true; }
     85        virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
     86        virtual void SetMass(float mass) { }
     87        virtual void InitBodyToRigid() { }
     88        virtual void InitBodyToGhost() { }
     89        virtual void AddToSimulation(class Simulation* current_simulation) { }
     90        virtual void RemoveFromSimulation(class Simulation* current_simulation) { }
     91        virtual mat4 GetTransform() { return mat4(1.0f); }
    9292
    9393#endif // PHYSIC IMPLEMENTATION
     
    9696        //Sets the collision Group & Mask.
    9797        //Mask can change at runtime, not group !
    98         bool SetCollisionChannel(int NewGroup, int NewMask)
     98        virtual bool SetCollisionChannel(int NewGroup, int NewMask)
    9999        {
    100100                if (CanChangeCollisionChannel())
     
    114114        int                                                                                     m_collision_group;
    115115        int                                                                                     m_collision_mask;
     116};
     117
     118class EasyCharacterController : public EasyPhysic
     119{
     120
     121#ifdef HAVE_PHYS_USE_BULLET
     122
     123public:
     124        EasyCharacterController();
     125        ~EasyCharacterController();
     126
     127        virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
     128        virtual void SetMass(float mass);
     129        virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false);
     130        virtual void InitBodyToGhost();
     131        virtual void AddToSimulation(class Simulation* current_simulation);
     132        virtual void RemoveFromSimulation(class Simulation* current_simulation);
     133        virtual mat4 GetTransform();
     134
     135protected:
     136
     137        btPairCachingGhostObject*               m_pair_caching_object;
     138
     139#else  // NO PHYSIC IMPLEMENTATION
     140
     141#endif // PHYSIC IMPLEMENTATION
     142
    116143};
    117144
Note: See TracChangeset for help on using the changeset viewer.