1- use bevy:: { input:: common_conditions:: input_just_pressed, prelude:: * } ;
2- use bevy_fly_camera:: FlyCamera ;
1+ use bevy:: {
2+ camera_controller:: free_camera:: FreeCamera , input:: common_conditions:: input_just_pressed,
3+ prelude:: * ,
4+ } ;
35use oktree:: prelude:: * ;
46use std:: { ops:: BitAnd , sync:: Arc } ;
57
@@ -141,13 +143,17 @@ fn update_pos_text(
141143}
142144
143145fn debug_world (
144- camera : Query < & Transform , ( With < FlyCamera > , Without < WireMe > ) > ,
146+ camera : Query < & Transform , ( With < FreeCamera > , Without < WireMe > ) > ,
145147 debug_amount : Res < DebugAmount > ,
146148 cells : Res < ChunkCells > ,
147149 mut gizmos : Gizmos ,
148150) -> Result < ( ) , BevyError > {
149151 let origin = camera. single ( ) ?. translation ;
150152
153+ if !debug_amount. grid {
154+ return Ok ( ( ) ) ;
155+ }
156+
151157 for pos in cells
152158 . collied_vec
153159 . iter ( )
@@ -157,7 +163,7 @@ fn debug_world(
157163 } )
158164 . filter ( |pos| pos. distance ( origin) < 500. )
159165 {
160- gizmos. cuboid (
166+ gizmos. cube (
161167 Transform :: from_translation ( pos) . with_scale ( Vec3 :: splat ( CELL_SIZE ) ) ,
162168 Color :: srgba_u8 ( 255 , 0 , 0 , 255 ) ,
163169 ) ;
@@ -181,7 +187,7 @@ fn debug_world(
181187 } )
182188 . filter ( |( center, _) | center. distance ( origin) < 500. )
183189 {
184- gizmos. cuboid (
190+ gizmos. cube (
185191 Transform :: from_translation ( center) . with_scale ( scale) ,
186192 Color :: srgba_u8 ( 255 , 255 , 0 , 255 ) ,
187193 ) ;
@@ -206,7 +212,7 @@ fn debug_pathfinding(
206212}
207213
208214fn add_pathfinding_points (
209- camera : Query < & Transform , ( With < FlyCamera > , Without < WireMe > ) > ,
215+ camera : Query < & Transform , ( With < FreeCamera > , Without < WireMe > ) > ,
210216 mut points : ResMut < PathfindingPoints > ,
211217) -> Result < ( ) , BevyError > {
212218 let origin = camera. single ( ) ?. translation . trunc ( ) ;
@@ -239,8 +245,8 @@ fn add_navmesh_resource(mut commands: Commands, cells: Res<ChunkCells>) {
239245
240246fn debug_contents (
241247 mut ray_cast : MeshRayCast ,
242- camera : Query < & Transform , ( With < FlyCamera > , Without < WorldMesh > ) > ,
243- world_meshes : Query < & Mesh3d , ( With < WorldMesh > , Without < FlyCamera > ) > ,
248+ camera : Query < & Transform , ( With < FreeCamera > , Without < WorldMesh > ) > ,
249+ world_meshes : Query < & Mesh3d , ( With < WorldMesh > , Without < FreeCamera > ) > ,
244250 meshes : Res < Assets < Mesh > > ,
245251 mut text : Query < Entity , With < MeshInfoText > > ,
246252 mut writer : TextUiWriter ,
0 commit comments