1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Move the nametag back to the top of the player (#6179)

read the actual height of the collisionbox
This commit is contained in:
TeTpaAka 2017-07-29 19:24:10 +02:00 committed by SmallJoker
parent 765fd9a0bc
commit d504831ee2
3 changed files with 18 additions and 7 deletions

View file

@ -617,7 +617,7 @@ void Camera::drawNametags()
// shadow can remain.
continue;
}
v3f pos = nametag->parent_node->getAbsolutePosition() + v3f(0.0, 1.1 * BS, 0.0);
v3f pos = nametag->parent_node->getAbsolutePosition() + nametag->nametag_pos * BS;
f32 transformed_pos[4] = { pos.X, pos.Y, pos.Z, 1.0f };
trans.multiplyWith1x4Matrix(transformed_pos);
if (transformed_pos[3] > 0) {
@ -641,9 +641,10 @@ void Camera::drawNametags()
}
Nametag *Camera::addNametag(scene::ISceneNode *parent_node,
std::string nametag_text, video::SColor nametag_color)
const std::string &nametag_text, video::SColor nametag_color,
const v3f &pos)
{
Nametag *nametag = new Nametag(parent_node, nametag_text, nametag_color);
Nametag *nametag = new Nametag(parent_node, nametag_text, nametag_color, pos);
m_nametags.push_back(nametag);
return nametag;
}