entity/player: rotate nametag to face player (#746)

Nametag is rotated to face the player (Around the Y axes. it still doesn't rotate up or down, I don't know how to rotate it on both axis)
This commit is contained in:
Slushie 2022-12-31 08:30:22 -08:00 committed by GitHub
parent 96ff1c5c15
commit 67e019faba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -211,12 +211,9 @@ impl ecs::System for PlayerRenderer {
// TODO This sucks
if player_model.has_name_tag {
let ang = (position.position.x - renderer.camera.pos.x)
.atan2(position.position.z - renderer.camera.pos.z)
as f32;
mdl.matrix[PlayerModelPart::NameTag as usize] = Matrix4::from(Decomposed {
scale: 1.0,
rot: Quaternion::from_angle_y(Rad(ang)),
rot: Quaternion::from_angle_y(Rad(renderer.camera.yaw as f32)),
disp: offset + Vector3::new(0.0, (-24.0 / 16.0) - 0.6, 0.0),
});
}