fn ray_cast(
            mut runs: Local<'_, i32>,
            physics_world: PhysicsWorld<'_>,
            test_colliders: Query<'_, (), With<RayCastTestCollider>>,
        ) {
            // Skip the first run to give time for the world to setup
            if *runs == 0 {
                *runs = *runs + 1;
                return;
            }

            // Cast a ray upword to try and hit the block we spawned with setup_ray_cast_test_app()
            let result = physics_world.ray_cast(Vec3::default(), Vec3::new(0., 200., 0.), true);

            // Verify we hit the block
            if let Some(info) = result {
                // Make sure we hit where we think we should have
                assert!(info.collision_point.distance(Vec3::new(0., 90., 0.)) < 0.1);

                // Make sure we hit the block we think we should have
                assert!(test_colliders.get(info.entity).is_ok());
            } else {
                panic!("Ray cast did not collide when we expected it to");
            }
        }
/// The system to test ray casting
The system to test ray casting
The system to test ray casting
fn ray_cast(
            mut runs: Local<'_, i32>,
            physics_world: PhysicsWorld<'_>,
            test_colliders: Query<'_, (), With<RayCastTestCollider>>,
        ) {
            // Skip the first run to give time for the world to setup
            if *runs == 0 {
                *runs = *runs + 1;
                return;
            }
            // Cast a ray upword to try and hit the block we spawned with setup_ray_cast_test_app()
            let result = physics_world.ray_cast(Vec3::default(), Vec3::new(0., 200., 0.), true);
            // Verify we hit the block
            if let Some(info) = result {
                // Make sure we hit where we think we should have
                assert!(info.collision_point.distance(Vec3::new(0., 90., 0.)) < 0.1);
                // Make sure we hit the block we think we should have
                assert!(test_colliders.get(info.entity).is_ok());
            } else {
                panic!("Ray cast did not collide when we expected it to");
            }
        }
fn ray_cast ( mut runs : Local < ' _ , i32 > , physics_world : PhysicsWorld < ' _ > , test_colliders : Query < ' _ , ( ) , With < RayCastTestCollider > > , ) { // Skip the first run to give time for the world to setup if * runs == 0 { * runs = * runs + 1 ; return ; } // Cast a ray upword to try and hit the block we spawned with setup_ray_cast_test_app() let result = physics_world . ray_cast ( Vec3 :: default ( ) , Vec3 :: new ( 0. , 200. , 0. ) , true ) ; // Verify we hit the block if let Some ( info ) = result { // Make sure we hit where we think we should have assert ! ( info collision_point distance ( Vec3 new ( 0. 90. 0. ) ) 0.1 ) ; // Make sure we hit the block we think we should have assert ! ( test_colliders get ( info entity ) is_ok ( ) ) ; } else { panic ! ( " " ) ; } }
The system to test ray casting
The system to test ray casting
runs
Local<'_, i32>
physics_world
PhysicsWorld<'_>
test_colliders
Query<'_, (), With<RayCastTestCollider>>
runs
Local<'_, i32>
physics_world
PhysicsWorld<'_>
test_colliders
Query<'_, (), With<RayCastTestCollider>>