M Cargo.lock => Cargo.lock +6 -13
@@ 721,16 721,8 @@ dependencies = [
"bevy",
"bevy_picking_core",
"bevy_picking_input",
- "bevy_picking_raycast",
-]
-
-[[package]]
-name = "bevy_mod_raycast"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc98a75743120396c8f3e3b47bfeb7f3d39248c46a625972005e51ca4d110a2a"
-dependencies = [
- "bevy",
+ "bevy_picking_rapier",
+ "bevy_rapier3d",
]
[[package]]
@@ 775,14 767,14 @@ dependencies = [
]
[[package]]
-name = "bevy_picking_raycast"
+name = "bevy_picking_rapier"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fca29f78b3812dc864d60ec7b65007342f3494a0dfcfe4a2109519b1c60ea3"
+checksum = "c245bee94a619fa9a52706f53ca1d7de47e6c0e0b715f9d72c2988f65802b569"
dependencies = [
"bevy",
- "bevy_mod_raycast",
"bevy_picking_core",
+ "bevy_rapier3d",
]
[[package]]
@@ 2372,6 2364,7 @@ dependencies = [
"bevy_editor_pls",
"bevy_egui",
"bevy_mod_picking",
+ "bevy_picking_rapier",
"bevy_rapier3d",
"bevy_text_mesh",
"chrono",
M client/Cargo.toml => client/Cargo.toml +4 -1
@@ 59,9 59,12 @@ version = "0.6.0"
version = "0.13.0"
default-features = false
features = [
- "backend_raycast",
+ "backend_rapier",
]
+[dependencies.bevy_picking_rapier]
+version = "0.1.0"
+
[dependencies.bevy_egui]
version = "0.20.2"
default-features = false
M client/src/main.rs => client/src/main.rs +1 -1
@@ 108,7 108,7 @@ fn setup(mut commands: Commands) {
},
..Default::default()
},
- RaycastPickCamera::default(),
+ RapierPickCamera::default(),
))
.insert(PlayerCamera);
}
M client/src/plugins/game/card/mod.rs => client/src/plugins/game/card/mod.rs +13 -1
@@ 8,6 8,7 @@
use bevy::prelude::*;
use bevy_mod_picking::prelude::*;
+use bevy_picking_rapier::RapierPickTarget;
use bevy_rapier3d::prelude::*;
use bevy_text_mesh::prelude::*;
@@ 139,6 140,18 @@ fn on_spawn_card(
new_cards: Query<(Entity, &VisualCard), Added<VisualCard>>,
) {
for (entity, card) in &new_cards {
+ commands.entity(entity).insert(
+ (
+ PickableBundle::default(),
+ RapierPickTarget::default(),
+ OnPointer::<Over>::target_component_mut::<Transform>(|_over, transform| {
+ transform.translation.y += 0.2;
+ }),
+ OnPointer::<Out>::target_component_mut::<Transform>(|_out, transform| {
+ transform.translation.y -= 0.2;
+ }),
+ )
+ );
commands.entity(entity).with_children(|parent| {
parent.spawn((
PbrBundle {
@@ 150,7 163,6 @@ fn on_spawn_card(
},
..Default::default()
},
- RaycastPickTarget::default(),
));
// card name