Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix shapecast at start not being detected. #277

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading