本文整理汇总了C#中Geom.FindDNC方法的典型用法代码示例。如果您正苦于以下问题:C# Geom.FindDNC方法的具体用法?C# Geom.FindDNC怎么用?C# Geom.FindDNC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geom
的用法示例。
在下文中一共展示了Geom.FindDNC方法的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.FindDNC(_geometryB) || _geometryB.FindDNC(_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);
}
}
}