Skip to content

Add example to output a debugdump#576

Merged
ThierryBerger merged 6 commits intodimforge:masterfrom
ThierryBerger:debugdump
Sep 13, 2024
Merged

Add example to output a debugdump#576
ThierryBerger merged 6 commits intodimforge:masterfrom
ThierryBerger:debugdump

Conversation

@ThierryBerger
Copy link
Contributor

@ThierryBerger ThierryBerger commented Aug 8, 2024

This kind of example can be useful to both maintainers and users, to help understanding current state of the plugin, how things interact together.

Also there are some system ambiguities which are difficult to reason about in code, this visualization can help with that:

post_update graph

@ThierryBerger ThierryBerger changed the title Add example to output a debugdump of postupdate Add example to output a debugdump Aug 8, 2024
Comment on lines 26 to 37
pub fn display_events(
mut collision_events: EventReader<CollisionEvent>,
mut contact_force_events: EventReader<ContactForceEvent>,
) {
for collision_event in collision_events.read() {
println!("Received collision event: {collision_event:?}");
}

for contact_force_event in contact_force_events.read() {
println!("Received contact force event: {contact_force_event:?}");
}
}
Copy link
Contributor Author

@ThierryBerger ThierryBerger Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User systems are not strictly neeed and maybe should be removed ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let’s just stick to the rapier systems here.

Copy link
Member

@sebcrozet sebcrozet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines 26 to 37
pub fn display_events(
mut collision_events: EventReader<CollisionEvent>,
mut contact_force_events: EventReader<ContactForceEvent>,
) {
for collision_event in collision_events.read() {
println!("Received collision event: {collision_event:?}");
}

for contact_force_event in contact_force_events.read() {
println!("Received contact force event: {contact_force_event:?}");
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let’s just stick to the rapier systems here.

@ThierryBerger ThierryBerger merged commit 5e91c6c into dimforge:master Sep 13, 2024
Jondolf added a commit to avianphysics/avian that referenced this pull request Sep 20, 2024
# Objective

- I appreciate graphs from [`bevy_mod_debugdump`](https://github.com/jakobhellermann/bevy_mod_debugdump), this PR merely starts a discussion on adding some "first party" interest to such graphs.
- it can be useful to compare with bevy_rapier: dimforge/bevy_rapier#576

## Solution

- Add an example to generate those

Run with: `cargo run --example debugdump_3d > avian.dot  && dot -Tsvg avian.dot > avian.svg`

## Output for 3d

<details><summary>PhysicsSchedule</summary>
<p>

![dump_physics](https://github.com/user-attachments/assets/0ac6d299-0cb2-4f1f-987a-763afcc2f57c)

</p>
</details> 

<details><summary>SubstepSchedule</summary>
<p>

![dump_substeps](https://github.com/user-attachments/assets/189a1141-95d8-459f-8d28-a4807f38ed4e)

</p>
</details> 

<details><summary>FixedPostUpdate</summary>
<p>

![dump_fixed_update](https://github.com/user-attachments/assets/12488f54-932a-494c-a90b-929320c363aa)

</p>
</details> 


<details><summary>Update</summary>
<p>

![dump_update](https://github.com/user-attachments/assets/051a4d79-a626-4a3c-905d-084d16afd798)

</p>
</details> 

---

## Changelog

- Add an example to generate systems ordering graphs.

---------

Co-authored-by: Joona Aalto <jondolf.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants