fix jupiter's rotational axis

This commit is contained in:
yuni 2024-04-16 23:31:08 +02:00
parent 7475b104ba
commit f95a69c095

View file

@ -455,15 +455,16 @@ fn handle_cheats(
// This avoids rendering glitches when very far away from the origin. // This avoids rendering glitches when very far away from the origin.
pub fn position_to_transform( pub fn position_to_transform(
q_player: Query<&Position, With<actor::PlayerCamera>>, q_player: Query<&Position, With<actor::PlayerCamera>>,
mut q_trans: Query<(&'static mut Transform, &'static Position), Without<Parent>>, mut q_trans: Query<(&'static mut Transform, &'static Position, &'static Rotation), Without<Parent>>,
) { ) {
if let Ok(player_pos) = q_player.get_single() { if let Ok(player_pos) = q_player.get_single() {
for (mut transform, pos) in &mut q_trans { for (mut transform, pos, rot) in &mut q_trans {
transform.translation = Vec3::new( transform.translation = Vec3::new(
(pos.x - player_pos.x) as f32, (pos.x - player_pos.x) as f32,
(pos.y - player_pos.y) as f32, (pos.y - player_pos.y) as f32,
(pos.z - player_pos.z) as f32, (pos.z - player_pos.z) as f32,
); );
transform.rotation = rot.as_quat();
} }
} }
} }