ryot 0.2.2

MMORPG library based on the concepts of open tibia written in rust and bevy.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::position::Sector;
use bevy::prelude::{Camera, OrthographicProjection, Query, Transform, With};

pub fn update_camera_visible_sector(
    mut camera_query: Query<(&mut Sector, &Transform, &OrthographicProjection), With<Camera>>,
) {
    for (mut sector, transform, projection) in camera_query.iter_mut() {
        let new_sector = Sector::from_transform_and_projection(transform, projection);

        if new_sector == *sector {
            continue;
        }

        *sector = new_sector;
    }
}