Exemple #1
0
            public bool TreeCallback(int id)
            {
                AABB aabb;
                Box  box = (Box)broadPhase.Tree.GetUserData(id);

                box.ComputeAABB(box.body.GetTransform(), out aabb);

                if (AABB.AABBtoAABB(Aabb, aabb))
                {
                    return(cb.ReportShape(box));
                }

                return(true);
            }
Exemple #2
0
        // Adds a box to this body. Boxes are all defined in local space
        // of their owning body. Boxes cannot be defined relative to one
        // another. The body will recalculate its mass values. No contacts
        // will be created until the next Scene::Step( ) call.
        public Box AddBox(BoxDef def)
        {
            AABB aabb;
            Box  box = new Box()
            {
                local       = def.Tx,
                e           = def.E,
                body        = this,
                friction    = def.Friction,
                restitution = def.Restitution,
                density     = def.Density,
                sensor      = def.Sensor,
            };

            Boxes.Add(box);
            box.ComputeAABB(Tx, out aabb);

            CalculateMassData();

            Scene.ContactManager.Broadphase.InsertBox(box, aabb);
            Scene.NewBox = true;

            return(box);
        }