本文整理汇总了C#中BEPUphysics.BroadPhaseEntries.BroadPhaseEntry类的典型用法代码示例。如果您正苦于以下问题:C# BroadPhaseEntry类的具体用法?C# BroadPhaseEntry怎么用?C# BroadPhaseEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BroadPhaseEntry类属于BEPUphysics.BroadPhaseEntries命名空间,在下文中一共展示了BroadPhaseEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
instancedMesh = entryA as InstancedMesh;
convex = entryB as ConvexCollidable;
if (instancedMesh == null || convex == null)
{
instancedMesh = entryB as InstancedMesh;
convex = entryA as ConvexCollidable;
if (instancedMesh == null || convex == null)
throw new Exception("Inappropriate types used to initialize pair.");
}
//Contact normal goes from A to B.
broadPhaseOverlap.entryA = convex;
broadPhaseOverlap.entryB = instancedMesh;
UpdateMaterialProperties(convex.entity != null ? convex.entity.material : null, instancedMesh.material);
base.Initialize(entryA, entryB);
}
示例2: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
mobileMesh = entryA as MobileMeshCollidable;
convex = entryB as ConvexCollidable;
if (mobileMesh == null || convex == null)
{
mobileMesh = entryB as MobileMeshCollidable;
convex = entryA as ConvexCollidable;
if (mobileMesh == null || convex == null)
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
//Contact normal goes from A to B.
broadPhaseOverlap.entryA = convex;
broadPhaseOverlap.entryB = mobileMesh;
//It's possible that the convex does not have an entity if it is a proxy for a non-entity collidable.
//Similarly, the mesh could be a query object.
UpdateMaterialProperties(convex.entity != null ? convex.entity.material : null, mobileMesh.entity != null ? mobileMesh.entity.material : null);
base.Initialize(entryA, entryB);
}
示例3: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
terrain = entryA as Terrain;
convex = entryB as ConvexCollidable;
if (terrain == null || convex == null)
{
terrain = entryB as Terrain;
convex = entryA as ConvexCollidable;
if (terrain == null || convex == null)
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
//Contact normal goes from A to B.
broadPhaseOverlap.entryA = convex;
broadPhaseOverlap.entryB = terrain;
UpdateMaterialProperties(convex.entity != null ? convex.entity.material : null, terrain.material);
base.Initialize(entryA, entryB);
}
示例4: Remove
public override void Remove(BroadPhaseEntry entry)
{
base.Remove(entry);
entriesX.Remove(entry);
entriesY.Remove(entry);
entriesZ.Remove(entry);
}
示例5: Add
/// <summary>
/// Adds an entry to the broad phase.
/// </summary>
/// <param name="entry">Entry to add.</param>
public override void Add(BroadPhaseEntry entry)
{
base.Add(entry);
//Entities do not set up their own bounding box before getting stuck in here. If they're all zeroed out, the tree will be horrible.
Vector3 offset;
Vector3.Subtract(ref entry.boundingBox.Max, ref entry.boundingBox.Min, out offset);
if (offset.X * offset.Y * offset.Z == 0)
entry.UpdateBoundingBox();
//binary search for the approximately correct location. This helps prevent large first-frame sort times.
int minIndex = 0; //inclusive
int maxIndex = entries.Count; //exclusive
int index = 0;
while (maxIndex - minIndex > 0)
{
index = (maxIndex + minIndex) / 2;
if (entries.Elements[index].boundingBox.Min.X > entry.boundingBox.Min.X)
maxIndex = index;
else if (entries.Elements[index].boundingBox.Min.X < entry.boundingBox.Min.X)
minIndex = ++index;
else
break; //Found an equal value!
}
entries.Insert(index, entry);
}
示例6: IgnoreThis
public bool IgnoreThis(BroadPhaseEntry entry)
{
if (entry is EntityCollidable && ((EntityCollidable)entry).Entity == Entity)
{
return false;
}
return Collision.ShouldCollide(entry);
}
示例7: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
//Child initialization is responsible for setting up the entries.
//Child initialization is responsible for setting up the manifold, if any.
manifoldConstraintGroup.Initialize(EntityA, EntityB);
base.Initialize(entryA, entryB);
}
示例8: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
compoundInfoB = entryB as CompoundCollidable;
if (compoundInfoB == null)
{
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
base.Initialize(entryA, entryB);
}
示例9: DontLandOnPlanes
public bool DontLandOnPlanes(BroadPhaseEntry bpe)
{
if (bpe is EntityCollidable)
{
EntityCollidable ec = bpe as EntityCollidable;
if (ec.Entity != null && (ec.Entity.Tag is PlayerEntity || ec.Entity.Tag is PlaneEntity))
{
return false;
}
}
return true;
}
示例10: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
//Child initialization is responsible for setting up the entries.
ContactManifold.Initialize(CollidableA, CollidableB);
ContactConstraint.Initialize(EntityA, EntityB, this);
base.Initialize(entryA, entryB);
}
示例11: Initialize
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
base.Initialize(entryA, entryB);
convex = entryA as ConvexCollidable;
if (convex == null)
{
convex = entryB as ConvexCollidable;
if (convex == null)
{
throw new ArgumentException("Incorrect types passed to pair handler.");
}
}
}
示例12: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
mesh = entryA as InstancedMesh;
if (mesh == null)
{
mesh = entryB as InstancedMesh;
if (mesh == null)
{
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
}
base.Initialize(entryA, entryB);
}
示例13: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
convexInfo = entryA as ConvexCollidable;
if (convexInfo == null)
{
convexInfo = entryB as ConvexCollidable;
if (convexInfo == null)
{
throw new Exception("Inappropriate types used to initialize pair.");
}
}
base.Initialize(entryA, entryB);
}
示例14: Add
public override void Add(BroadPhaseEntry entry)
{
base.Add(entry);
//binary search for the approximately correct location. This helps prevent large first-frame sort times.
//X Axis:
int minIndex = 0; //inclusive
int maxIndex = entriesX.Count; //exclusive
int index = 0;
while (maxIndex - minIndex > 0)
{
index = (maxIndex + minIndex) / 2;
if (entriesX.Elements[index].boundingBox.Min.X > entry.boundingBox.Min.X)
maxIndex = index;
else if (entriesX.Elements[index].boundingBox.Min.X < entry.boundingBox.Min.X)
minIndex = ++index;
else
break; //Found an equal value!
}
entriesX.Insert(index, entry);
//Y Axis:
minIndex = 0; //inclusive
maxIndex = entriesY.Count; //exclusive
while (maxIndex - minIndex > 0)
{
index = (maxIndex + minIndex) / 2;
if (entriesY.Elements[index].boundingBox.Min.Y > entry.boundingBox.Min.Y)
maxIndex = index;
else if (entriesY.Elements[index].boundingBox.Min.Y < entry.boundingBox.Min.Y)
minIndex = ++index;
else
break; //Found an equal value!
}
entriesY.Insert(index, entry);
//Z Axis:
minIndex = 0; //inclusive
maxIndex = entriesZ.Count; //exclusive
while (maxIndex - minIndex > 0)
{
index = (maxIndex + minIndex) / 2;
if (entriesZ.Elements[index].boundingBox.Min.Z > entry.boundingBox.Min.Z)
maxIndex = index;
else if (entriesZ.Elements[index].boundingBox.Min.Z < entry.boundingBox.Min.Z)
minIndex = ++index;
else
break; //Found an equal value!
}
entriesZ.Insert(index, entry);
}
示例15: Initialize
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
//Other member of the pair is initialized by the child.
staticGroup = entryA as StaticGroup;
if (staticGroup == null)
{
staticGroup = entryB as StaticGroup;
if (staticGroup == null)
{
throw new Exception("Inappropriate types used to initialize pair.");
}
}
base.Initialize(entryA, entryB);
}