We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
macmini m2
bevy = "0.13.2" bevy_rapier2d = { version = "0.26.0", features = [ "simd-stable", "debug-render-2d" ] }
use bevy::{prelude::*, sprite::MaterialMesh2dBundle}; use bevy_rapier2d::prelude::*; fn main() { App::new() .add_plugins(( DefaultPlugins, RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0), RapierDebugRenderPlugin::default(), )) .add_systems(Startup, setup) .add_systems(Update, debug_print) .run(); } fn debug_print(query: Query<&Velocity, With<Ball>>) { let velocity = query.single(); println!("{velocity:?}"); } #[derive(Component)] struct Ball; #[derive(Component)] struct Wall; fn setup( mut commands: Commands, mut material: ResMut<Assets<ColorMaterial>>, mut meshes: ResMut<Assets<Mesh>>, ) { commands.spawn(Camera2dBundle::default()); commands.spawn(( Ball, MaterialMesh2dBundle { mesh: meshes.add(Mesh::from(Circle::new(20.0))).into(), material: material.add(Color::RED), ..default() }, RigidBody::Dynamic, Collider::ball(20.0), Restitution::coefficient(1.0), Friction::coefficient(0.0), GravityScale(0.0), Velocity { linvel: Vec2::new(500.0, 300.0), ..default() }, )); commands.spawn(( Wall, MaterialMesh2dBundle { mesh: meshes.add(Mesh::from(Rectangle::new(800.0, 10.0))).into(), material: material.add(Color::LIME_GREEN), transform: Transform::from_xyz(0.0, 300.0, 0.0), ..default() }, RigidBody::Fixed, Collider::cuboid(400.0, 5.0), Restitution::coefficient(1.0), Friction::coefficient(0.0), )); commands.spawn(( Wall, MaterialMesh2dBundle { mesh: meshes.add(Mesh::from(Rectangle::new(800.0, 10.0))).into(), material: material.add(Color::LIME_GREEN), transform: Transform::from_xyz(0.0, -300.0, 0.0), ..default() }, RigidBody::Fixed, Collider::cuboid(400.0, 5.0), Restitution::coefficient(1.0), Friction::coefficient(0.0), )); commands.spawn(( Wall, MaterialMesh2dBundle { mesh: meshes.add(Mesh::from(Rectangle::new(10.0, 600.0))).into(), material: material.add(Color::LIME_GREEN), transform: Transform::from_xyz(400.0, 0.0, 0.0), ..default() }, RigidBody::Fixed, Collider::cuboid(5.0, 300.0), Restitution::coefficient(1.0), Friction::coefficient(0.0), )); commands.spawn(( Wall, MaterialMesh2dBundle { mesh: meshes.add(Mesh::from(Rectangle::new(10.0, 600.0))).into(), material: material.add(Color::LIME_GREEN), transform: Transform::from_xyz(-400.0, 0.0, 0.0), ..default() }, RigidBody::Fixed, Collider::cuboid(5.0, 300.0), Restitution::coefficient(1.0), Friction::coefficient(0.0), )); }
the speed of the printed ball is constant
The ball's speed changes after multiple collisions with the wall.
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 } Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
system:
macmini m2
cargo.toml version:
bevy = "0.13.2"
bevy_rapier2d = { version = "0.26.0", features = [ "simd-stable", "debug-render-2d" ] }
code:
expect:
the speed of the printed ball is constant
result:
The ball's speed changes after multiple collisions with the wall.
print log:
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
Velocity { linvel: Vec2(366.13907, 300.00055), angvel: 0.0 }
The text was updated successfully, but these errors were encountered: