Example #1
0
        protected GImpactQuantizedBvh m_box_set = new GImpactQuantizedBvh();// optionally boxset

        //! declare Quantized trees, (you can change to float based trees)
        //typedef btGImpactQuantizedBvh btGImpactBoxSet;



        //! Base class for gimpact shapes
        //class btGImpactShapeInterface : public ConcaveShape
        //{
        //protected:
        //    btAABB m_localAABB;
        //    bool m_needs_update;
        //    btVector3  localScaling;
        //    btGImpactBoxSet m_box_set;// optionally boxset

        //! use this function for perfofm refit in bounding boxes
        //! use this function for perfofm refit in bounding boxes
        protected virtual void CalcLocalAABB()
        {
            LockChildShapes();
            if (m_box_set.GetNodeCount() == 0)
            {
                m_box_set.BuildSet();
            }
            else
            {
                m_box_set.Update();
            }
            UnlockChildShapes();

            m_localAABB = m_box_set.GetGlobalBox();
        }
Example #2
0
        public static void FindCollision(GImpactQuantizedBvh boxset0, ref IndexedMatrix trans0,
                                         GImpactQuantizedBvh boxset1, ref IndexedMatrix trans1,
                                         PairSet collision_pairs)
        {
            if (boxset0.GetNodeCount() == 0 || boxset1.GetNodeCount() == 0)
            {
                return;
            }

            BT_BOX_BOX_TRANSFORM_CACHE trans_cache_1to0 = new BT_BOX_BOX_TRANSFORM_CACHE();

            trans_cache_1to0.CalcFromHomogenic(ref trans0, ref trans1);

#if TRI_COLLISION_PROFILING
            BulletGlobals.StartProfile("GIMPACT-TRIMESH");
#endif //TRI_COLLISION_PROFILING

            FindQuantizedCollisionPairsRecursive(boxset0, boxset1, collision_pairs, ref trans_cache_1to0, 0, 0, true);
#if TRI_COLLISION_PROFILING
            BulletGlobals.StopProfile();
#endif //TRI_COLLISION_PROFILING
        }