Changeset 1601


Ignore:
Timestamp:
Jul 8, 2012, 9:22:08 PM (7 years ago)
Author:
touky
Message:

EasyPhysics : Added Capsules.

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/PhysicObject.h

    r1600 r1601  
    7272                MeshRand << "[sc#aad scb#aad ad16 2 0 rx180 ty-1 my ac16 2 2 2 0 0]";
    7373
     74                int CapsLimit = MeshRand.Count();
     75
     76                MeshRand << "[sc#add scb#add asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]";
     77                MeshRand << "[sc#dad scb#dad asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]";
     78                MeshRand << "[sc#dda scb#dda asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]";
     79                MeshRand << "[sc#daa scb#daa asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]";
     80                MeshRand << "[sc#ada scb#ada asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]";
     81                MeshRand << "[sc#aad scb#aad asph16 2 2 2 ty-1 my ac16 2 1 1 0 0]";
     82
    7483                int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1));
    7584
     
    8291                else if (RandValue < CylLimit)
    8392                        m_physics.SetShapeToCone(BoxSize.x, BoxSize.y);
     93                else if (RandValue < CapsLimit)
     94                        m_physics.SetShapeToCylinder(BoxSize);
    8495                else
    85                         m_physics.SetShapeToCylinder(BoxSize);
     96                        m_physics.SetShapeToCapsule(BoxSize.x, BoxSize.y);
    8697
    8798                m_physics.SetMass(base_mass);
  • trunk/test/Physics/EasyPhysics.cpp

    r1600 r1601  
    9494}
    9595
     96void EasyPhysics::SetShapeToCapsule(float radius, float height)
     97{
     98        SetShapeTo(new btCapsuleShape(  radius * LOL2BT_UNIT * LOL2BT_SIZE,
     99                                                                        height * LOL2BT_UNIT * LOL2BT_SIZE));
     100}
     101
    96102//-------------------------------------------------------------------------
    97103//Base Location/Rotation setup
  • trunk/test/Physics/EasyPhysics.h

    r1600 r1601  
    4141        void SetShapeToCone(float radius, float height);
    4242        void SetShapeToCylinder(lol::vec3& cyl_size);
     43        void SetShapeToCapsule(float radius, float height);
    4344
    4445        void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
     
    6869        void SetShapeToBox(lol::vec3& BoxSize) { }
    6970        void SetShapeToSphere(float radius) { }
     71        void SetShapeToCone(float radius, float height) { }
     72        void SetShapeToCylinder(lol::vec3& cyl_size) { }
     73        void SetShapeToCapsule(float radius, float height) { }
     74
    7075        void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { }
    7176        void SetMass(float mass) { }
Note: See TracChangeset for help on using the changeset viewer.