Turn name tags to the camera in third-person front view

Name tags faced the player's own look, so in the front view (F5 twice) every name and hologram read mirrored. They now face the camera, turned round in that view, like Camera.rotation().
This commit is contained in:
Kacpherek committed 2026-10-28 06:58:59 +01:00
1 parent 56f968e11c
commit c66554126d
1 file changed
+9 -1
+9 -1
View File
@@ -328,7 +328,15 @@ impl Game<'_> {
) {
// Options.getBackgroundOpacity(0.25) black, as ARGB.color.
const BACKGROUND: u32 = 0x3F00_0000;
let forward = glam::DVec3::from_array(view_vector(self.yaw, self.pitch));
// The camera's facing (Camera.rotation()), turned round in third-person
// front view, so the text reads the right way from where it is seen.
let (view_yaw, view_pitch) =
if self.camera_type == super::perspective::CameraType::ThirdPersonFront {
(self.yaw + 180.0, -self.pitch)
} else {
(self.yaw, self.pitch)
};
let forward = glam::DVec3::from_array(view_vector(view_yaw, view_pitch));
let right = forward.cross(glam::DVec3::Y).normalize_or_zero();
let up = right.cross(forward).normalize_or_zero();
let white = self.gui.atlas.font.white();