示例#1
0
        public void   StoreIslandActivationState(CollisionWorld colWorld)
        {
            // put the islandId ('find' value) into m_tag
            {
                int index = 0;
                int i;
                CollisionObject[] collisionObjects = colWorld.GetCollisionObjectArray().GetRawArray();
                int length = colWorld.GetCollisionObjectArray().Count;
                for (i = 0; i < length; i++)
                {
                    CollisionObject collisionObject = collisionObjects[i];
                    if (!collisionObject.IsStaticOrKinematicObject())
                    {
                        lock (m_unionFind)
                        {
                            collisionObject.SetIslandTag(m_unionFind.Find(index));
                            //Set the correct object offset in Collision Object Array
                            //m_unionFind.GetElement(index).m_sz = i;

                            m_unionFind.SetElementSize(index, i);
                        }
                        collisionObject.SetCompanionId(-1);
                        index++;
                    }
                    else
                    {
                        collisionObject.SetIslandTag(-1);
                        collisionObject.SetCompanionId(-2);
                    }
                }
            }
        }
示例#2
0
        public void UpdateActivationState(CollisionWorld colWorld, IDispatcher dispatcher)
        {
            // put the index into m_controllers into m_tag
            int index = 0;

            {
                int i;

                CollisionObject[] collisionObjects = colWorld.GetCollisionObjectArray().GetRawArray();
                int length = colWorld.GetCollisionObjectArray().Count;
                for (i = 0; i < length; i++)
                {
                    CollisionObject collisionObject = collisionObjects[i];
                    //Adding filtering here
                    if (!collisionObject.IsStaticOrKinematicObject())
                    {
                        collisionObject.SetIslandTag(index++);
                    }
                    collisionObject.SetCompanionId(-1);
                    collisionObject.SetHitFraction(1.0f);
                }
            }
            // do the union find

            InitUnionFind(index);

            FindUnions(dispatcher, colWorld);
        }
示例#3
0
        public virtual void StoreIslandActivationState(CollisionWorld collisionWorld)
        {
            int index = 0;
            ObjectArray <CollisionObject> list = collisionWorld.GetCollisionObjectArray();
            int length = list.Count;

            CollisionObject[] rawList = list.GetRawArray();
            for (int i = 0; i < length; ++i)
            {
                CollisionObject collisionObject = rawList[i];
                if (!collisionObject.IsStaticOrKinematicObject())
                {
                    collisionObject.SetIslandTag(m_unionFind.Find(index));
                    collisionObject.SetCompanionId(-1);
                }
                else
                {
                    collisionObject.SetIslandTag(-1);
                    collisionObject.SetCompanionId(-2);
                }
                index++;
            }
        }
示例#4
0
        public virtual void UpdateActivationState(CollisionWorld collisionWorld, IDispatcher dispatcher)
        {
            InitUnionFind(collisionWorld.GetCollisionObjectArray().Count);

            // put the index into m_controllers into m_tag
            {
                int index = 0;
                ObjectArray <CollisionObject> list = collisionWorld.GetCollisionObjectArray();
                int length = list.Count;
                CollisionObject[] rawList = list.GetRawArray();
                for (int i = 0; i < length; ++i)
                {
                    CollisionObject collisionObject = rawList[i];
                    collisionObject.SetIslandTag(index);
                    collisionObject.SetCompanionId(-1);
                    collisionObject.SetHitFraction(1f);
                    index++;
                }
            }
            // do the union find

            FindUnions(dispatcher, collisionWorld);
        }