Tested on avian3d = "0.1" and bevy="0.14.0"
There are only 2 systems because the rest of the code does not fit into the quota.
So...
If there is only one cube, the impulse is not work, in case 2 or more but without gravity - too.
(without gravity cubes don't touch )
This makes me think the cubes must touch each other to impulse work 🙂
Can anyone explain this mystery?
And I should note that with bevy_xpbd_3d ="0.5" everything works as it should.
fn setup(
mut commands: Commands,
mut materials: ResMut<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>,
) {
let cube_mesh = meshes.add(Cuboid::default());
let cube_size = 2.0;
for i in 1..=2 { // if single - dont work
commands.spawn((
PbrBundle {
mesh: cube_mesh.clone(),
material: materials.add(Color::srgb(0.2, 0.7, 0.9)),
transform: Transform::from_translation(vec3(0., 5. + 3. * i as f32 , 0.))
.with_scale(Vec3::splat(cube_size as f32)),
..default()
},
RigidBody::Dynamic,
Collider::cuboid(1.0, 1.0, 1.0),
ExternalImpulse::new(Vec3::ZERO).with_persistence(false),
GravityScale(0.) // if present - dont work
));
}
}
fn movement(
keyboard_input: Res<ButtonInput<KeyCode>>,
mut query: Query<&mut ExternalImpulse>,
) {
for mut external_impulse in query.iter_mut() {
if keyboard_input.just_pressed(KeyCode::Space) {
external_impulse.set_impulse(Vec3::X * 50.);
}
}
}