Struct CollidableDescription
- Namespace
- BepuPhysics.Collidables
- Assembly
- BepuPhysics.dll
Describes a collidable and how it should handle continuous collision detection.
public struct CollidableDescription
- Inherited Members
Constructors
CollidableDescription(TypedIndex)
Constructs a new collidable description with Passive. Will use a MinimumSpeculativeMargin of 0 and a MaximumSpeculativeMargin of MaxValue.
public CollidableDescription(TypedIndex shape)
Parameters
shape
TypedIndexShape used by the collidable.
Remarks
Passive and Discrete are equivalent in behavior when the MaximumSpeculativeMargin is MaxValue since they both result in the same (unbounded) expansion of body bounding boxes in response to velocity.
CollidableDescription(TypedIndex, ContinuousDetection)
Constructs a new collidable description. Uses 0 for the MinimumSpeculativeMargin and MaxValue for the MaximumSpeculativeMargin .
public CollidableDescription(TypedIndex shape, ContinuousDetection continuity)
Parameters
shape
TypedIndexShape used by the collidable.
continuity
ContinuousDetectionContinuous collision detection settings for the collidable.
CollidableDescription(TypedIndex, float)
Constructs a new collidable description with Discrete. Will use a minimum speculative margin of 0 and the given maximumSpeculativeMargin.
public CollidableDescription(TypedIndex shape, float maximumSpeculativeMargin)
Parameters
shape
TypedIndexShape used by the collidable.
maximumSpeculativeMargin
floatMaximum speculative margin to be used with the discrete continuity configuration.
CollidableDescription(TypedIndex, float, ContinuousDetection)
Constructs a new collidable description. Uses 0 for the MinimumSpeculativeMargin .
public CollidableDescription(TypedIndex shape, float maximumSpeculativeMargin, ContinuousDetection continuity)
Parameters
shape
TypedIndexShape used by the collidable.
maximumSpeculativeMargin
floatUpper bound on the value of the speculative margin used by the collidable.
continuity
ContinuousDetectionContinuous collision detection settings for the collidable.
CollidableDescription(TypedIndex, float, float)
Constructs a new collidable description with Discrete.
public CollidableDescription(TypedIndex shape, float minimumSpeculativeMargin, float maximumSpeculativeMargin)
Parameters
shape
TypedIndexShape used by the collidable.
minimumSpeculativeMargin
floatLower bound on the value of the speculative margin used by the collidable.
maximumSpeculativeMargin
floatUpper bound on the value of the speculative margin used by the collidable.
CollidableDescription(TypedIndex, float, float, ContinuousDetection)
Constructs a new collidable description.
public CollidableDescription(TypedIndex shape, float minimumSpeculativeMargin, float maximumSpeculativeMargin, ContinuousDetection continuity)
Parameters
shape
TypedIndexShape used by the collidable.
minimumSpeculativeMargin
floatLower bound on the value of the speculative margin used by the collidable.
maximumSpeculativeMargin
floatUpper bound on the value of the speculative margin used by the collidable.
continuity
ContinuousDetectionContinuous collision detection settings for the collidable.
Fields
Continuity
Continuous collision detection settings used by the collidable.
public ContinuousDetection Continuity
Field Value
MaximumSpeculativeMargin
Upper bound on the value of the speculative margin used by the collidable.
public float MaximumSpeculativeMargin
Field Value
Remarks
MaxValue tends to be a good default value for discrete or passive mode collidables. The speculative margin will increase in size proportional to velocity magnitude, so having an unlimited maximum won't cost extra if the body isn't moving fast.
Smaller values can be useful for improving performance in chaotic situations where missing a collision is acceptable. When using Continuous, a speculative margin larger than the velocity magnitude will result in the sweep test being skipped, so lowering the maximum margin can help avoid ghost collisions.
MinimumSpeculativeMargin
Lower bound on the value of the speculative margin used by the collidable.
public float MinimumSpeculativeMargin
Field Value
Remarks
0 tends to be a good default value. Higher values can be chosen if velocity magnitude is a poor proxy for speculative margins, but these cases are rare. In those cases, try to use the smallest value that still satisfies requirements to avoid creating unnecessary contact constraints.
Shape
Shape of the collidable.
public TypedIndex Shape
Field Value
Operators
implicit operator CollidableDescription(TypedIndex)
Constructs a new collidable description with Passive. Will use a minimum speculative margin of 0 and a maximum of MaxValue.
public static implicit operator CollidableDescription(TypedIndex shapeIndex)
Parameters
shapeIndex
TypedIndexShape index to use for the collidable.