Skip to content

Commit

Permalink
Fix early return
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceeri committed Sep 28, 2023
1 parent c25fa02 commit cf6a974
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions bevy_rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ serde = { version = "1", features = [ "derive" ], optional = true}
bevy = { version = "0.11", default-features = false, features = ["x11"]}
approx = "0.5.1"
glam = { version = "0.24", features = [ "approx" ] }
bevy-inspector-egui = "0.19"

[package.metadata.docs.rs]
# Enable all the features when building the docs on docs.rs
Expand Down
2 changes: 2 additions & 0 deletions bevy_rapier3d/examples/boxes3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn main() {
DefaultPlugins,
RapierPhysicsPlugin::<NoUserData>::default(),
RapierDebugRenderPlugin::default(),
bevy_inspector_egui::quick::WorldInspectorPlugin::default(),
))
.add_systems(Startup, (setup_graphics, setup_physics))
.run();
Expand All @@ -33,6 +34,7 @@ pub fn setup_physics(mut commands: Commands) {
let ground_height = 0.1;

commands.spawn((
Name::new("Ground"),
TransformBundle::from(Transform::from_xyz(0.0, -ground_height, 0.0)),
Collider::cuboid(ground_size, ground_height, ground_size),
));
Expand Down
32 changes: 32 additions & 0 deletions bevy_rapier3d/examples/kinematic_velocity.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use bevy::prelude::*;
use bevy_rapier3d::prelude::*;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(RapierPhysicsPlugin::<NoUserData>::default())
.add_plugins(RapierDebugRenderPlugin::default())
.insert_resource(RapierConfiguration::default())
.add_systems(Startup, setup)
.add_systems(Update, test)
.run();
}

fn test(ctx: Res<RapierContext>, query: Query<(Entity, &Transform), With<RigidBody>>) {
for (entity, transform) in &query {
info!("transform: {:.1?}", transform.translation);
}
}

fn setup(mut commands: Commands) {
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-3.0, 3.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
..Default::default()
});

commands
.spawn(RigidBody::KinematicVelocityBased)
.insert(Collider::ball(0.5))
.insert(Velocity::linear(Vec3::Y * -1.81))
.insert(TransformBundle::from(Transform::from_xyz(0.0, 1.0, 0.0)));
}
Binary file added new.tracy
Binary file not shown.
Binary file added novelocity.tracy
Binary file not shown.
2 changes: 1 addition & 1 deletion src/plugin/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ pub fn writeback_rigid_bodies(
let context = &mut *context;
let scale = context.physics_scale;

if config.physics_pipeline_active {
if !config.physics_pipeline_active {
return;
}

Expand Down
Binary file added writeback-2.tracy
Binary file not shown.
Binary file added writeback-3.tracy
Binary file not shown.
Binary file added writeback.tracy
Binary file not shown.

0 comments on commit cf6a974

Please sign in to comment.