Skip to content
Merged
Show file tree
Hide file tree
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
25 changes: 19 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ tracing = "0.1.37"
puffin = { version = "0.17.0", features = ["web"] }
puffin_egui = "0.23.0"
petgraph = "0.6.4"
# Use rapier w/ parry2d 0.13.7 for qbvh crash fix: https://github.com/dimforge/parry/pull/185
rapier2d = { git = "https://github.com/MaxCWhitehead/rapier.git", rev = "29c72c6c282e7c40987c0d0d0ce3089ea019a532", features = [
rapier2d = { version = "0.19.0", features = [
"debug-render",
"enhanced-determinism",
] }
Expand Down
11 changes: 5 additions & 6 deletions src/core/physics/collisions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use indexmap::IndexMap;

use rapier::Vector;
use rapier2d::geometry::InteractionGroups;
use rapier2d::parry::query::ShapeCastOptions;
pub use rapier2d::prelude as rapier;
pub use shape::*;

Expand Down Expand Up @@ -1118,8 +1119,7 @@ impl<'a> CollisionWorld<'a> {
&position,
&velocity,
&**shape,
1.0,
true,
ShapeCastOptions::with_max_time_of_impact(1.0),
rapier::QueryFilter::new().predicate(&|_handle, rapier_collider| {
let ent = RapierUserData::entity(rapier_collider.user_data);

Expand All @@ -1142,7 +1142,7 @@ impl<'a> CollisionWorld<'a> {
let ent = RapierUserData::entity(collider_set.get(handle).unwrap().user_data);

// Move up to the point of collision
let diff = dy * toi.toi;
let diff = dy * toi.time_of_impact;
movement += diff;
position.translation.y += diff;

Expand Down Expand Up @@ -1258,8 +1258,7 @@ impl<'a> CollisionWorld<'a> {
&position,
&velocity,
&**shape,
1.0,
true,
ShapeCastOptions::with_max_time_of_impact(1.0),
rapier::QueryFilter::new().predicate(&|_handle, rapier_collider| {
let ent = RapierUserData::entity(rapier_collider.user_data);

Expand All @@ -1283,7 +1282,7 @@ impl<'a> CollisionWorld<'a> {
let ent = RapierUserData::entity(collider_set.get(handle).unwrap().user_data);

// Move up to the point of collision
let diff = dx * toi.toi;
let diff = dx * toi.time_of_impact;
movement += diff;
position.translation.x += diff;

Expand Down
Loading