@@ -81,7 +81,8 @@ fn setup(
81
81
PbrBundle {
82
82
mesh : cube_mesh. clone ( ) ,
83
83
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 ) ) ,
85
86
..default ( )
86
87
} ,
87
88
RayIndicator ,
@@ -154,7 +155,7 @@ fn raycast(
154
155
query : SpatialQuery ,
155
156
mut materials : ResMut < Assets < StandardMaterial > > ,
156
157
cubes : Query < ( & Handle < StandardMaterial > , & OutOfGlass ) > ,
157
- mut indicator_transform : Query < & mut Transform , With < RayIndicator > >
158
+ mut indicator_transform : Query < & mut Transform , With < RayIndicator > > ,
158
159
) {
159
160
let origin = Vector {
160
161
x : -200.0 ,
@@ -192,10 +193,8 @@ fn raycast(
192
193
// set length of rayindicator to look more like a laser
193
194
let contact_point = ( origin + direction * ray_hit_data. time_of_impact ) . x ;
194
195
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 {
199
198
ray_indicator_transform. scale . x = 2000.0 ;
200
199
}
201
200
}
0 commit comments