fix crash in handle_wants_lookat/trans.up() when trans.translation is 0

This commit is contained in:
yuni 2024-09-16 04:07:36 +02:00
parent cb34bba7d8
commit cdc1dcec36

View file

@ -624,7 +624,12 @@ fn handle_wants_lookat(
} else {
continue;
};
rot.0 = look_at_quat(**pos, target_pos, trans.up().as_dvec3());
let up = if trans.translation.length_squared() > 1e-6 {
trans.up()
} else {
Dir3::Y
};
rot.0 = look_at_quat(**pos, target_pos, up.as_dvec3());
}
}