本文整理汇总了C#中BEPUphysics.BroadPhaseEntries.MobileCollidables.ConvexCollidable类的典型用法代码示例。如果您正苦于以下问题:C# ConvexCollidable类的具体用法?C# ConvexCollidable怎么用?C# ConvexCollidable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConvexCollidable类属于BEPUphysics.BroadPhaseEntries.MobileCollidables命名空间,在下文中一共展示了ConvexCollidable类的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)
{
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);
}
示例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)
{
box = entryA as ConvexCollidable<BoxShape>;
sphere = entryB as ConvexCollidable<SphereShape>;
if (box == null || sphere == null)
{
box = entryB as ConvexCollidable<BoxShape>;
sphere = entryA as ConvexCollidable<SphereShape>;
if (box == null || sphere == null)
{
throw new Exception("Inappropriate types used to initialize pair.");
}
}
//Reorder the entries so that the guarantee that the normal points from A to B is satisfied.
broadPhaseOverlap.entryA = box;
broadPhaseOverlap.entryB = sphere;
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: 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);
}
示例5: QueryManager
/// <summary>
/// Constructs the query manager for a character.
/// </summary>
/// <param name="character">Character to manage queries for.</param>
public QueryManager(SphereCharacterController character)
{
this.character = character;
//We can share the real shape with the 'current' query object.
queryObject = new ConvexCollidable<SphereShape>(character.Body.CollisionInformation.Shape);
//Share the collision rules between the main body and its query objects. That way, the character's queries return valid results.
queryObject.CollisionRules = character.Body.CollisionInformation.CollisionRules;
SupportRayFilter = SupportRayFilterFunction;
}
示例6: StepManager
float upStepMargin = .1f; //There's a little extra space above the maximum step height to start the obstruction and downcast test rays. Helps when a step is very close to the max step height.
#endregion Fields
#region Constructors
/// <summary>
/// Constructs a new step manager for a character.
/// </summary>
/// <param name="characterBody">The character's body.</param>
/// <param name="contactCategorizer">Contact categorizer used by the character.</param>
/// <param name="supportFinder">Support finder used by the character.</param>
/// <param name="queryManager">Query provider to use in checking for obstructions.</param>
/// <param name="horizontalMotionConstraint">Horizontal motion constraint used by the character. Source of 3d movement direction.</param>
public StepManager(Cylinder characterBody, CharacterContactCategorizer contactCategorizer, SupportFinder supportFinder, QueryManager queryManager, HorizontalMotionConstraint horizontalMotionConstraint)
{
this.characterBody = characterBody;
currentQueryObject = new ConvexCollidable<CylinderShape>(characterBody.CollisionInformation.Shape);
ContactCategorizer = contactCategorizer;
SupportFinder = supportFinder;
QueryManager = queryManager;
HorizontalMotionConstraint = horizontalMotionConstraint;
//The minimum step height is just barely above where the character would generally find the ground.
//This helps avoid excess tests.
minimumUpStepHeight = CollisionDetectionSettings.AllowedPenetration * 1.1f;// Math.Max(0, -.01f + character.Body.CollisionInformation.Shape.CollisionMargin * (1 - character.SupportFinder.sinMaximumSlope));
}
示例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)
{
convexA = entryA as ConvexCollidable;
convexB = entryB as ConvexCollidable;
if (convexA == null || convexB == null)
{
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
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)
{
boxA = entryA as ConvexCollidable<BoxShape>;
boxB = entryB as ConvexCollidable<BoxShape>;
if (boxA == null || boxB == null)
{
throw new Exception("Inappropriate types used to initialize pair.");
}
base.Initialize(entryA, entryB);
}
示例9: 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.");
}
}
}
示例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)
{
sphereA = entryA as ConvexCollidable<SphereShape>;
sphereB = entryB as ConvexCollidable<SphereShape>;
if (sphereA == null || sphereB == null)
{
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
base.Initialize(entryA, entryB);
}
示例11: 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)
{
triangle = entryA as ConvexCollidable<TriangleShape>;
convex = entryB as ConvexCollidable;
if (triangle == null || convex == null)
{
triangle = entryB as ConvexCollidable<TriangleShape>;
convex = entryA as ConvexCollidable;
if (triangle == null || convex == null)
throw new ArgumentException("Inappropriate types used to initialize pair.");
}
//Contact normal goes from A to B.
broadPhaseOverlap.entryA = convex;
broadPhaseOverlap.entryB = triangle;
base.Initialize(entryA, entryB);
}
示例12: StanceManager
/// <summary>
/// Constructs a stance manager for a character.
/// </summary>
/// <param name="characterBody">The character's body entity.</param>
/// <param name="crouchingHeight">Crouching height of the character.</param>
/// <param name="queryManager">Provider of queries used by the stance manager to test if it is okay to change stances.</param>
/// <param name="supportFinder">Support finder used by the character.</param>
public StanceManager(Cylinder characterBody, float crouchingHeight, QueryManager queryManager, SupportFinder supportFinder)
{
this.QueryManager = queryManager;
this.SupportFinder = supportFinder;
this.characterBody = characterBody;
standingHeight = characterBody.Height;
if (crouchingHeight < standingHeight)
this.crouchingHeight = StandingHeight * .7f;
else
throw new ArgumentException("Crouching height must be less than standing height.");
//We can share the real shape with the query objects.
currentQueryObject = new ConvexCollidable<CylinderShape>(characterBody.CollisionInformation.Shape);
standingQueryObject = new ConvexCollidable<CylinderShape>(new CylinderShape(StandingHeight, characterBody.Radius));
crouchingQueryObject = new ConvexCollidable<CylinderShape>(new CylinderShape(CrouchingHeight, characterBody.Radius));
//Share the collision rules between the main body and its query objects. That way, the character's queries return valid results.
currentQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
standingQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
crouchingQueryObject.CollisionRules = characterBody.CollisionInformation.CollisionRules;
}
示例13: CleanUp
///<summary>
/// Cleans up the pair handler.
///</summary>
public override void CleanUp()
{
base.CleanUp();
triangle = null;
convex = null;
}
示例14: CleanUp
///<summary>
/// Cleans up the pair handler.
///</summary>
public override void CleanUp()
{
base.CleanUp();
terrain = null;
convex = null;
}
示例15: CleanUp
///<summary>
/// Cleans up the pair handler.
///</summary>
public override void CleanUp()
{
base.CleanUp();
convexA = null;
convexB = null;
}