aboutsummaryrefslogtreecommitdiff
path: root/src/pipeline
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-03-30 17:08:51 +0200
committerCrozet Sébastien <developer@crozet.re>2021-03-30 17:10:50 +0200
commitd2ee6420538d7ee524f2096995d4f44fcfef4551 (patch)
treea2aa5564fb16830cc224f451f6c56be19d191cf5 /src/pipeline
parentc3a0c67272e09d3bb4f80aca145ff580d0172745 (diff)
downloadrapier-d2ee6420538d7ee524f2096995d4f44fcfef4551.tar.gz
rapier-d2ee6420538d7ee524f2096995d4f44fcfef4551.tar.bz2
rapier-d2ee6420538d7ee524f2096995d4f44fcfef4551.zip
CCD: take angular motion and penetration depth into account in various thresholds.
Diffstat (limited to 'src/pipeline')
-rw-r--r--src/pipeline/query_pipeline.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/pipeline/query_pipeline.rs b/src/pipeline/query_pipeline.rs
index 5b2cc88..5451cfa 100644
--- a/src/pipeline/query_pipeline.rs
+++ b/src/pipeline/query_pipeline.rs
@@ -38,10 +38,20 @@ struct QueryPipelineAsCompositeShape<'a> {
groups: InteractionGroups,
}
+/// Indicates how the colliders position should be taken into account when
+/// updating the query pipeline.
pub enum QueryPipelineMode {
+ /// The `Collider::position` is taken into account.
CurrentPosition,
+ /// The `RigidBody::next_position * Collider::position_wrt_parent` is taken into account for
+ /// the colliders positions.
SweepTestWithNextPosition,
- SweepTestWithPredictedPosition { dt: Real },
+ /// The `RigidBody::predict_position_using_velocity_and_forces * Collider::position_wrt_parent`
+ /// is taken into account for the colliders position.
+ SweepTestWithPredictedPosition {
+ /// The time used to integrate the rigid-body's velocity and acceleration.
+ dt: Real,
+ },
}
impl<'a> TypedSimdCompositeShape for QueryPipelineAsCompositeShape<'a> {
@@ -137,19 +147,19 @@ impl QueryPipeline {
self.quadtree.clear_and_rebuild(data, self.dilation_factor);
}
QueryPipelineMode::SweepTestWithNextPosition => {
- let data = colliders.iter().map(|(h, co)| {
+ let data = colliders.iter().map(|(h, c)| {
let next_position =
- bodies[co.parent()].next_position * co.position_wrt_parent();
- (h, co.compute_swept_aabb(&next_position))
+ bodies[c.parent()].next_position * c.position_wrt_parent();
+ (h, c.compute_swept_aabb(&next_position))
});
self.quadtree.clear_and_rebuild(data, self.dilation_factor);
}
QueryPipelineMode::SweepTestWithPredictedPosition { dt } => {
- let data = colliders.iter().map(|(h, co)| {
- let next_position = bodies[co.parent()]
+ let data = colliders.iter().map(|(h, c)| {
+ let next_position = bodies[c.parent()]
.predict_position_using_velocity_and_forces(dt)
- * co.position_wrt_parent();
- (h, co.compute_swept_aabb(&next_position))
+ * c.position_wrt_parent();
+ (h, c.compute_swept_aabb(&next_position))
});
self.quadtree.clear_and_rebuild(data, self.dilation_factor);
}