Skip to content

Commit 65256b1

Browse files
author
Hendrik Decke
committed
cargo fmt and fix double precision error in example
1 parent 4e5c53d commit 65256b1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

crates/bevy_xpbd_3d/examples/cast_ray_predicate.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ fn setup(
8181
PbrBundle {
8282
mesh: cube_mesh.clone(),
8383
material: materials.add(Color::rgb(1.0, 0.0, 0.0).into()),
84-
transform: Transform::from_xyz(-500.0, 2.0, 0.0).with_scale(Vec3::new(1000.0, 0.1, 0.1)),
84+
transform: Transform::from_xyz(-500.0, 2.0, 0.0)
85+
.with_scale(Vec3::new(1000.0, 0.1, 0.1)),
8586
..default()
8687
},
8788
RayIndicator,
@@ -154,7 +155,7 @@ fn raycast(
154155
query: SpatialQuery,
155156
mut materials: ResMut<Assets<StandardMaterial>>,
156157
cubes: Query<(&Handle<StandardMaterial>, &OutOfGlass)>,
157-
mut indicator_transform: Query<&mut Transform, With<RayIndicator>>
158+
mut indicator_transform: Query<&mut Transform, With<RayIndicator>>,
158159
) {
159160
let origin = Vector {
160161
x: -200.0,
@@ -192,10 +193,8 @@ fn raycast(
192193
// set length of rayindicator to look more like a laser
193194
let contact_point = (origin + direction * ray_hit_data.time_of_impact).x;
194195
let target_scale = 1000.0 + contact_point * 2.0;
195-
ray_indicator_transform.scale.x = target_scale;
196-
197-
}
198-
else {
196+
ray_indicator_transform.scale.x = target_scale as f32;
197+
} else {
199198
ray_indicator_transform.scale.x = 2000.0;
200199
}
201200
}

0 commit comments

Comments
 (0)