use crate::ecs::EditorWorld;
use nightshade::prelude::*;
pub fn rotate(editor_world: &mut EditorWorld, world: &mut World) {
if !editor_world.resources.loading.loaded {
return;
}
let speed = editor_world.resources.rotation.rotation_speed;
if speed == 0.0 {
return;
}
let entities: Vec<Entity> = editor_world.resources.loading.model_entities.clone();
for entity in entities {
if let Some(transform) = world.core.get_local_transform_mut(entity) {
let rotation =
nalgebra_glm::quat_angle_axis(speed * 0.016, &nalgebra_glm::vec3(0.0, 1.0, 0.0));
transform.rotation = rotation * transform.rotation;
}
mark_local_transform_dirty(world, entity);
}
}