-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Split RapierContext #585
Merged
Merged
Split RapierContext #585
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
b9f3a6f
add example to output a debugdump of postupdate
Vrixyz ff03180
better multiple sets for propagate transforms
Vrixyz 16c3e3f
allow system race for writeback
Vrixyz b669fe2
remove ambiguity from example
Vrixyz 2c586e9
Merge remote-tracking branch 'upstream' into debugdump
Vrixyz 310ab56
filter out some less relevant systems
Vrixyz 8e553a8
Merge branch 'debugdump' into system_schedules
Vrixyz e32c4a6
remove dbg
Vrixyz ad498ee
Merge branch 'debugdump' into system_schedules
Vrixyz c7ee449
split joints and colliders out of rapier context
Vrixyz 6beece6
split query pipeline + add a 'RapierContextWhole', designed to be the…
Vrixyz 20c47d8
split rigidbody set
Vrixyz 7519a8c
Merge branch 'master' into split_rapiercontext
Vrixyz 4df1d88
use a RapierContext systemparam for a better API ; rework modules + u…
Vrixyz 6b44512
add some missing doc for systemparams
Vrixyz 7b93dba
remove unnecessary macro + fix clippy + docs
Vrixyz fe1b49a
use a bundle to create correct rapier context components
Vrixyz 83c795f
Merge branch 'master' into split_rapiercontext
Vrixyz 78dc64e
add an example to access a specific component of RapierContext
Vrixyz 8d78d77
changelog adaptations
Vrixyz 3e98da1
more functions transparent for RapierContext and RapierContextMut
Vrixyz a8c94b4
Merge branch 'master' into split_rapiercontext
Vrixyz e302ed9
avoid using term 'world' when referring to a physics context, to avoi…
Vrixyz 7cff2c2
please clippy
Vrixyz 6698a9e
Merge upstream main into split_rapiercontext
Vrixyz 186dcd2
Merge remote-tracking branch 'upstream' into split_rapiercontext
Vrixyz e5adab3
adapt changelog +_doc + bevy 0.15 fixes
Vrixyz 64127e5
use required components
Vrixyz fc82f9b
run component example after syncBackend to have correct state at the …
Vrixyz 6950734
run component example after syncBackend to have correct state at the …
Vrixyz d9701e1
fix doc
Vrixyz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use bevy::prelude::*; | ||
use bevy_rapier3d::prelude::*; | ||
|
||
fn main() { | ||
App::new() | ||
.add_plugins(( | ||
DefaultPlugins, | ||
RapierPhysicsPlugin::<NoUserData>::default(), | ||
RapierDebugRenderPlugin::default(), | ||
)) | ||
.add_systems(Startup, (setup_physics, setup_graphics)) | ||
.add_systems(PostUpdate, display_nb_colliders) | ||
.run(); | ||
} | ||
|
||
/// Demonstrates how to access a more specific component of [`RapierContext`] | ||
fn display_nb_colliders( | ||
query_context: Query<&RapierContextColliders, With<DefaultRapierContext>>, | ||
mut exit: EventWriter<AppExit>, | ||
) { | ||
let nb_colliders = query_context.single().colliders.len(); | ||
println!("There are {nb_colliders} colliders."); | ||
if nb_colliders > 0 { | ||
exit.send(AppExit::Success); | ||
} | ||
} | ||
|
||
pub fn setup_physics(mut commands: Commands) { | ||
/* | ||
* Ground | ||
*/ | ||
let ground_size = 5.1; | ||
let ground_height = 0.1; | ||
|
||
let starting_y = -0.5 - ground_height; | ||
|
||
commands.spawn(( | ||
TransformBundle::from(Transform::from_xyz(0.0, starting_y, 0.0)), | ||
Collider::cuboid(ground_size, ground_height, ground_size), | ||
)); | ||
|
||
for _ in 0..3 { | ||
/* | ||
* Create the cubes | ||
*/ | ||
|
||
commands.spawn(( | ||
TransformBundle::default(), | ||
RigidBody::Dynamic, | ||
Collider::cuboid(0.5, 0.5, 0.5), | ||
)); | ||
} | ||
} | ||
|
||
fn setup_graphics(mut commands: Commands) { | ||
commands.spawn(Camera3dBundle { | ||
transform: Transform::from_xyz(0.0, 3.0, -10.0) | ||
.looking_at(Vec3::new(0.0, 0.0, 0.0), Vec3::Y), | ||
..Default::default() | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could avoid this indirection to
single()
if we implemented all methods ofRapierContext
on its systemParam ; but: