So it seems in Bevy when I use the rotate function 3d objects rotate around the global origin. My current solution is the following where I first set the objects position to the global origin, rotate it, then move it back to it's original position:
fn rotator_system(time: Res<Time>, mut query: Query<(&Rotator, &mut Transform)>) {
for (_rotator, mut transform) in &mut query.iter() {
let position = transform.translation().clone();
transform.set_translation(Vec3::new(0.0, 0.0, 0.0));
transform.rotate(Quat::from_rotation_y(time.delta_seconds));
transform.translate(position);
}
}
Is this right solution or is there a better way?
This appears to be a related pull request: https://github.com/bevyengine/bevy/pull/564