Skip to content
Open
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
1 change: 1 addition & 0 deletions crates/rapier2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ serde-serialize = [
"dep:serde",
"bit-vec/serde",
"arrayvec/serde",
"vec_map/serde"
]
enhanced-determinism = ["simba/libm_force", "parry2d-f64/enhanced-determinism"]
debug-render = []
Expand Down
1 change: 1 addition & 0 deletions crates/rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ serde-serialize = [
"dep:serde",
"bit-vec/serde",
"arrayvec/serde",
"vec_map/serde"
]
enhanced-determinism = ["simba/libm_force", "parry2d/enhanced-determinism"]
debug-render = []
Expand Down
1 change: 1 addition & 0 deletions crates/rapier3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ serde-serialize = [
"parry3d-f64/serde-serialize",
"dep:serde",
"bit-vec/serde",
"vec_map/serde"
]
enhanced-determinism = ["simba/libm_force", "parry3d-f64/enhanced-determinism"]
debug-render = []
Expand Down
1 change: 1 addition & 0 deletions crates/rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ serde-serialize = [
"parry3d/serde-serialize",
"dep:serde",
"bit-vec/serde",
"vec_map/serde"
]
enhanced-determinism = ["simba/libm_force", "parry3d/enhanced-determinism"]
debug-render = []
Expand Down
2 changes: 1 addition & 1 deletion examples2d/one_way_platforms2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn init_world(testbed: &mut Testbed) {
}

for handle in physics.islands.active_bodies() {
let body = &mut physics.bodies[*handle];
let body = &mut physics.bodies[handle];
if body.position().translation.y > 1.0 {
body.set_gravity_scale(1.0, false);
} else if body.position().translation.y < -1.0 {
Expand Down
2 changes: 1 addition & 1 deletion examples3d/one_way_platforms3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub fn init_world(testbed: &mut Testbed) {
}

for handle in physics.islands.active_bodies() {
let body = physics.bodies.get_mut(*handle).unwrap();
let body = physics.bodies.get_mut(handle).unwrap();
if body.position().translation.y > 1.0 {
body.set_gravity_scale(1.0, false);
} else if body.position().translation.y < -1.0 {
Expand Down
6 changes: 6 additions & 0 deletions src/counters/collision_detection_counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pub struct CollisionDetectionCounters {
pub ncontact_pairs: usize,
/// Time spent for the broad-phase of the collision detection.
pub broad_phase_time: Timer,
/// Time spent by the final broad-phase AABB update after body movement to keep
/// user scene queries valid.
pub final_broad_phase_time: Timer,
/// Time spent for the narrow-phase of the collision detection.
pub narrow_phase_time: Timer,
}
Expand All @@ -18,6 +21,7 @@ impl CollisionDetectionCounters {
CollisionDetectionCounters {
ncontact_pairs: 0,
broad_phase_time: Timer::new(),
final_broad_phase_time: Timer::new(),
narrow_phase_time: Timer::new(),
}
}
Expand All @@ -26,6 +30,7 @@ impl CollisionDetectionCounters {
pub fn reset(&mut self) {
self.ncontact_pairs = 0;
self.broad_phase_time.reset();
self.final_broad_phase_time.reset();
self.narrow_phase_time.reset();
}
}
Expand All @@ -34,6 +39,7 @@ impl Display for CollisionDetectionCounters {
fn fmt(&self, f: &mut Formatter) -> Result {
writeln!(f, "Number of contact pairs: {}", self.ncontact_pairs)?;
writeln!(f, "Broad-phase time: {}", self.broad_phase_time)?;
writeln!(f, "Final broad-phase time: {}", self.final_broad_phase_time)?;
writeln!(f, "Narrow-phase time: {}", self.narrow_phase_time)
}
}
8 changes: 8 additions & 0 deletions src/counters/solver_counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub struct SolverCounters {
pub velocity_resolution_time: Timer,
/// Time spent for the assembly of all the velocity constraints.
pub velocity_assembly_time: Timer,
/// Time spent by the velocity assembly for initializing solver bodies.
pub velocity_assembly_time_solver_bodies: Timer,
/// Time spent by the velocity assemble for initializing the constraints.
pub velocity_assembly_time_constraints_init: Timer,
/// Time spent for the update of the velocity of the bodies.
pub velocity_update_time: Timer,
/// Time spent to write force back to user-accessible data.
Expand All @@ -25,6 +29,8 @@ impl SolverCounters {
nconstraints: 0,
ncontacts: 0,
velocity_assembly_time: Timer::new(),
velocity_assembly_time_solver_bodies: Timer::new(),
velocity_assembly_time_constraints_init: Timer::new(),
velocity_resolution_time: Timer::new(),
velocity_update_time: Timer::new(),
velocity_writeback_time: Timer::new(),
Expand All @@ -37,6 +43,8 @@ impl SolverCounters {
self.ncontacts = 0;
self.velocity_resolution_time.reset();
self.velocity_assembly_time.reset();
self.velocity_assembly_time_solver_bodies.reset();
self.velocity_assembly_time_constraints_init.reset();
self.velocity_update_time.reset();
self.velocity_writeback_time.reset();
}
Expand Down
9 changes: 9 additions & 0 deletions src/counters/stages_counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pub struct StagesCounters {
pub collision_detection_time: Timer,
/// Time spent for the computation of collision island and body activation/deactivation (sleeping).
pub island_construction_time: Timer,
/// Time spent for collecting awake constraints from islands.
pub island_constraints_collection_time: Timer,
/// Total time spent for the constraints resolution and position update.t
pub solver_time: Timer,
/// Total time spent for CCD and CCD resolution.
Expand All @@ -25,6 +27,7 @@ impl StagesCounters {
update_time: Timer::new(),
collision_detection_time: Timer::new(),
island_construction_time: Timer::new(),
island_constraints_collection_time: Timer::new(),
solver_time: Timer::new(),
ccd_time: Timer::new(),
user_changes: Timer::new(),
Expand All @@ -36,6 +39,7 @@ impl StagesCounters {
self.update_time.reset();
self.collision_detection_time.reset();
self.island_construction_time.reset();
self.island_constraints_collection_time.reset();
self.solver_time.reset();
self.ccd_time.reset();
self.user_changes.reset();
Expand All @@ -55,6 +59,11 @@ impl Display for StagesCounters {
"Island construction time: {}",
self.island_construction_time
)?;
writeln!(
f,
"Island construction time: {}",
self.island_constraints_collection_time
)?;
writeln!(f, "Solver time: {}", self.solver_time)?;
writeln!(f, "CCD time: {}", self.ccd_time)?;
writeln!(f, "User changes time: {}", self.user_changes)
Expand Down
6 changes: 3 additions & 3 deletions src/dynamics/ccd/ccd_solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl CCDSolver {

// println!("Checking CCD activation");
for handle in islands.active_bodies() {
let rb = bodies.index_mut_internal(*handle);
let rb = bodies.index_mut_internal(handle);

if rb.ccd.ccd_enabled {
let forces = if include_forces {
Expand Down Expand Up @@ -143,7 +143,7 @@ impl CCDSolver {
let mut min_toi = dt;

for handle in islands.active_bodies() {
let rb1 = &bodies[*handle];
let rb1 = &bodies[handle];

if rb1.ccd.ccd_active {
let predicted_body_pos1 = rb1.pos.integrate_forces_and_velocities(
Expand Down Expand Up @@ -276,7 +276,7 @@ impl CCDSolver {
*/
// TODO: don't iterate through all the colliders.
for handle in islands.active_bodies() {
let rb1 = &bodies[*handle];
let rb1 = &bodies[handle];

if rb1.ccd.ccd_active {
let predicted_body_pos1 = rb1.pos.integrate_forces_and_velocities(
Expand Down
Loading
Loading