Changeset 1751 for trunk/test


Ignore:
Timestamp:
Aug 15, 2012, 10:25:00 PM (8 years ago)
Author:
touky
Message:

Added a skeleton for Input Tracking & base idea for Touch/untouch mechanics.

File:
1 edited

Legend:

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

    r1749 r1751  
    157157        m_rigid_body = new btRigidBody(NewInfos);
    158158        m_collision_object = m_rigid_body;
     159        m_collision_object->setUserPointer(this);
    159160
    160161        if (m_mass == .0f)
     
    185186        m_ghost_object->setCollisionShape(m_collision_shape);
    186187        m_collision_object = m_ghost_object;
     188        m_collision_object->setUserPointer(this);
    187189
    188190        SetTransform(m_local_to_world.v3.xyz, lol::quat(m_local_to_world));
     
    190192        m_ghost_object->setCollisionFlags(m_ghost_object->getCollisionFlags());
    191193}
     194
     195//-------------
     196//Touch logic
     197//-------------
     198  //    btManifoldArray   manifoldArray;
     199  //    btBroadphasePairArray& pairArray = ghostObject->getOverlappingPairCache()->getOverlappingPairArray();
     200  //    int numPairs = pairArray.size();
     201
     202  //    for (int i=0;i<numPairs;i++)
     203  //    {
     204  //       manifoldArray.clear();
     205
     206  //       const btBroadphasePair& pair = pairArray[i];
     207  //       
     208  //       //unless we manually perform collision detection on this pair, the contacts are in the dynamics world paircache:
     209  //       btBroadphasePair* collisionPair = dynamicsWorld->getPairCache()->findPair(pair.m_pProxy0,pair.m_pProxy1);
     210  //       if (!collisionPair)
     211  //          continue;
     212
     213  //       if (collisionPair->m_algorithm)
     214  //          collisionPair->m_algorithm->getAllContactManifolds(manifoldArray);
     215
     216  //       for (int j=0;j<manifoldArray.size();j++)
     217  //       {
     218  //          btPersistentManifold* manifold = manifoldArray[j];
     219  //          btScalar directionSign = manifold->getBody0() == m_ghostObject ? btScalar(-1.0) : btScalar(1.0);
     220  //          for (int p=0;p<manifold->getNumContacts();p++)
     221  //          {
     222  //            const btManifoldPoint&pt = manifold->getContactPoint(p);
     223  //              if (pt.getDistance()<0.f)
     224                //{
     225                //      const btVector3& ptA = pt.getPositionWorldOnA();
     226                //      const btVector3& ptB = pt.getPositionWorldOnB();
     227                //      const btVector3& normalOnB = pt.m_normalWorldOnB;
     228                //      /// work here
     229                //}
     230  //          }
     231  //       }
     232  //    }
     233
    192234
    193235//Add Physic object to the simulation
Note: See TracChangeset for help on using the changeset viewer.