Пример #1
0
        public override void aabbTest(VInt3 aabbMin, VInt3 aabbMax, BroadphaseAabbCallback aabbCallback, Dispatcher dispatcher, short collisionFilterGroup, short collisionFilterMask)
        {
            BroadphaseAabbTester callback = new BroadphaseAabbTester(aabbCallback);

            DbvtAabbMm bounds = new DbvtAabbMm();

            DbvtAabbMm.FromMM(aabbMin, aabbMax, bounds);
            //process all children, that overlap with  the given AABB bounds
            sets[DYNAMIC_SET].collideTV(sets[DYNAMIC_SET].root, dispatcher, bounds, collisionFilterGroup, collisionFilterMask, callback);
            sets[FIXED_SET].collideTV(sets[FIXED_SET].root, dispatcher, bounds, collisionFilterGroup, collisionFilterMask, callback);
        }
Пример #2
0
        public override BroadphaseProxy createProxy(VInt3 aabbMin, VInt3 aabbMax, BroadphaseNativeType shapeType, CollisionObject collisionObject, short collisionFilterGroup, short collisionFilterMask, Dispatcher dispatcher)
        {
            DbvtProxy  proxy  = new DbvtProxy(collisionObject, collisionFilterGroup, collisionFilterMask);
            DbvtAabbMm volume = DbvtAabbMm.FromMM(aabbMin, aabbMax, new DbvtAabbMm());

            proxy.leaf              = sets[DYNAMIC_SET].insert(volume, proxy);
            proxy.stage             = DYNAMIC_SET;
            proxy.uniqueId          = UUID.GetNextUUID();
            stageRoots[DYNAMIC_SET] = listappend(proxy, stageRoots[DYNAMIC_SET]);
            return(proxy);
        }
Пример #3
0
        public override void setAabb(BroadphaseProxy absproxy, VInt3 aabbMin, VInt3 aabbMax, Dispatcher dispatcher)
        {
            DbvtProxy  proxy = (DbvtProxy)absproxy;
            DbvtAabbMm aabb  = DbvtAabbMm.FromMM(aabbMin, aabbMax, new DbvtAabbMm());

            if (aabb != proxy.leaf.volume)
            {
                proxy.leaf.volume = aabb;
                if (proxy.stage == FIXED_SET)
                {
                    sets[FIXED_SET].remove(proxy.leaf);
                    stageRoots[FIXED_SET]   = listremove(proxy, stageRoots[FIXED_SET]);
                    proxy.leaf              = sets[DYNAMIC_SET].insert(aabb, proxy);
                    proxy.stage             = DYNAMIC_SET;
                    stageRoots[DYNAMIC_SET] = listappend(proxy, stageRoots[DYNAMIC_SET]);
                }
                else
                {
                    // teleporting:
                    sets[DYNAMIC_SET].update(proxy.leaf, aabb);
                }
            }
        }