当前位置: 首页>>代码示例>>C#>>正文


C# Geom.IsGeometryIgnored方法代码示例

本文整理汇总了C#中Geom.IsGeometryIgnored方法的典型用法代码示例。如果您正苦于以下问题:C# Geom.IsGeometryIgnored方法的具体用法?C# Geom.IsGeometryIgnored怎么用?C# Geom.IsGeometryIgnored使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Geom的用法示例。


在下文中一共展示了Geom.IsGeometryIgnored方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        /// <summary>
        /// Updates this instance.
        /// </summary>
        public void Update()
        {
            //Iterate all the geoms and check against the next
            for (int i = 0; i < _physicsSimulator.GeomList.Count - 1; i++)
            {
                for (int j = i + 1; j < _physicsSimulator.GeomList.Count; j++)
                {
                    _geometryA = _physicsSimulator.GeomList[i];
                    _geometryB = _physicsSimulator.GeomList[j];

                    if (!_geometryA.body.Enabled || !_geometryB.body.Enabled)
                        continue;

                    if ((_geometryA.CollisionGroup == _geometryB.CollisionGroup) &&
                        _geometryA.CollisionGroup != 0 && _geometryB.CollisionGroup != 0)
                        continue;

                    if (!_geometryA.CollisionEnabled || !_geometryB.CollisionEnabled)
                        continue;

                    if (_geometryA.body.isStatic && _geometryB.body.isStatic)
                        continue;

                    if (_geometryA.body == _geometryB.body)
                        continue;

                    if (((_geometryA.CollisionCategories & _geometryB.CollidesWith) == CollisionCategory.None) &
                        ((_geometryB.CollisionCategories & _geometryA.CollidesWith) == CollisionCategory.None))
                        continue;

                    if (_geometryA.IsGeometryIgnored(_geometryB) || _geometryB.IsGeometryIgnored(_geometryA))
                    {
                        continue;
                    }

                    //Assume intersection
                    bool intersection = true;

                    //Check if there is no intersection
                    if (_geometryA.AABB.min.X > _geometryB.AABB.max.X || _geometryB.AABB.min.X > _geometryA.AABB.max.X)
                        intersection = false;
                    else if (_geometryA.AABB.min.Y > _geometryB.AABB.Max.Y || _geometryB.AABB.min.Y > _geometryA.AABB.Max.Y)
                        intersection = false;

                    //Call the OnBroadPhaseCollision event first. If the user aborts the collision
                    //it will not create an arbiter
                    if (OnBroadPhaseCollision != null)
                        intersection = OnBroadPhaseCollision(_geometryA, _geometryB);

                    //If the user aborted the intersection, continue to the next geometry.
                    if (!intersection)
                        continue;

                    Arbiter arbiter = _physicsSimulator.arbiterPool.Fetch();
                    arbiter.ConstructArbiter(_geometryA, _geometryB, _physicsSimulator);

                    if (!_physicsSimulator.ArbiterList.Contains(arbiter))
                        _physicsSimulator.ArbiterList.Add(arbiter);
                    else
                        _physicsSimulator.arbiterPool.Insert(arbiter);
                }
            }
        }
开发者ID:elefantstudio-se,项目名称:todesesser,代码行数:66,代码来源:BruteForceCollider.cs


注:本文中的Geom.IsGeometryIgnored方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。