Skip to content

Commit

Permalink
fix shapecast at start not being detected. (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu authored Oct 13, 2024
1 parent b672215 commit 9b31fcb
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/rapier_wrapper/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,6 @@ impl PhysicsEngine {
shape_vel2: Vector<Real>,
shape_info2: ShapeInfo,
) -> ShapeCastResult {
let mut shape_vel1 = shape_vel1;
if shape_vel1 == Vector::zeros() {
shape_vel1 = Vector::identity() * 1e-3;
}
let mut shape_vel2 = shape_vel2;
if shape_vel2 == Vector::zeros() {
shape_vel2 = -Vector::identity() * 1e-3;
}
let mut result = ShapeCastResult::new();
if let Some(raw_shared_shape1) = self.get_shape(shape_info1.handle) {
let shared_shape1 = scale_shape(raw_shared_shape1, shape_info1);
Expand All @@ -246,6 +238,7 @@ impl PhysicsEngine {
let shape_transform2 = shape_info2.transform;
let shape_cast_options = ShapeCastOptions {
max_time_of_impact: 1.0,
stop_at_penetration: true,
..Default::default()
};
let toi_result = parry::query::cast_shapes(
Expand Down Expand Up @@ -289,10 +282,6 @@ impl PhysicsEngine {
physics_ids: &PhysicsIds,
space: &RapierSpace,
) -> ShapeCastResult {
let mut shape_vel = shape_vel;
if shape_vel == Vector::zeros() {
shape_vel = Vector::identity() * 1e-3;
}
let mut result = ShapeCastResult::new();
if let Some(raw_shared_shape) = self.get_shape(shape_info.handle) {
let shared_shape = scale_shape(raw_shared_shape, shape_info);
Expand All @@ -317,7 +306,7 @@ impl PhysicsEngine {
filter.predicate = Some(&predicate);
let shape_cast_options = ShapeCastOptions {
max_time_of_impact: 1.0,
stop_at_penetration: false,
stop_at_penetration: true,
..Default::default()
};
if let Some((collider_handle, hit)) =
Expand Down

0 comments on commit 9b31fcb

Please sign in to comment.