Changeset 1597


Ignore:
Timestamp:
Jul 8, 2012, 7:36:10 PM (8 years ago)
Author:
touky
Message:

Added sphere in EasyPhysics

Location:
trunk/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/PhysicObject.h

    r1593 r1597  
    4545                MeshRand << "[sc#aad afcb2 2 2 -.1]";
    4646
     47                int SphereLimit = MeshRand.Count();
     48
     49                MeshRand << "[sc#add asph16 2 2 2]";
     50                MeshRand << "[sc#dad asph16 2 2 2]";
     51                MeshRand << "[sc#dda asph16 2 2 2]";
     52                MeshRand << "[sc#daa asph16 2 2 2]";
     53                MeshRand << "[sc#ada asph16 2 2 2]";
     54                MeshRand << "[sc#aad asph16 2 2 2]";
     55
     56
    4757                int RandValue = (int)(lol::RandF() * (MeshRand.Count() - 1));
    4858
    4959                m_mesh.Compile(MeshRand[RandValue]);
    5060                vec3 BoxSize = vec3(2.0f);
    51                 m_physics.SetShapeToBox(BoxSize);
     61                if (RandValue >= SphereLimit)
     62                        m_physics.SetShapeToSphere(BoxSize.x);
     63                else
     64                        m_physics.SetShapeToBox(BoxSize);
    5265                m_physics.SetMass(base_mass);
    5366                m_physics.SetBaseTransform(base_location);
  • trunk/test/Physics/EasyPhysics.cpp

    r1595 r1597  
    6969}
    7070
    71 //void EasyPhysics::SetShapeToSphere(lol::vec3& box_size)
    72 //{
    73 //      SetShapeTo(new btBoxShape(LOL2BT_VEC3(box_size * LOL2BT_UNIT * LOL2BT_SIZE)));
    74 //}
     71void EasyPhysics::SetShapeToSphere(float radius)
     72{
     73        SetShapeTo(new btSphereShape(radius * LOL2BT_UNIT * LOL2BT_SIZE));
     74}
    7575
    7676//-------------------------------------------------------------------------
  • trunk/test/Physics/EasyPhysics.h

    r1591 r1597  
    3737
    3838        void SetShapeToBox(lol::vec3& box_size);
     39        void SetShapeToSphere(float radius);
    3940        void SetBaseTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f)));
    4041        void SetMass(float mass);
Note: See TracChangeset for help on using the changeset viewer.