mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Allow rotating entity selectionboxes (#12379)
This commit is contained in:
parent
b829231992
commit
077627181e
18 changed files with 271 additions and 58 deletions
|
@ -3297,7 +3297,7 @@ PointedThing Game::updatePointedThing(
|
|||
{
|
||||
std::vector<aabb3f> *selectionboxes = hud->getSelectionBoxes();
|
||||
selectionboxes->clear();
|
||||
hud->setSelectedFaceNormal(v3f(0.0, 0.0, 0.0));
|
||||
hud->setSelectedFaceNormal(v3f());
|
||||
static thread_local const bool show_entity_selectionbox = g_settings->getBool(
|
||||
"show_entity_selectionbox");
|
||||
|
||||
|
@ -3321,7 +3321,13 @@ PointedThing Game::updatePointedThing(
|
|||
v3f pos = runData.selected_object->getPosition();
|
||||
selectionboxes->push_back(aabb3f(selection_box));
|
||||
hud->setSelectionPos(pos, camera_offset);
|
||||
GenericCAO* gcao = dynamic_cast<GenericCAO*>(runData.selected_object);
|
||||
if (gcao != nullptr && gcao->getProperties().rotate_selectionbox)
|
||||
hud->setSelectionRotation(gcao->getSceneNode()->getAbsoluteTransformation().getRotationDegrees());
|
||||
else
|
||||
hud->setSelectionRotation(v3f());
|
||||
}
|
||||
hud->setSelectedFaceNormal(result.raw_intersection_normal);
|
||||
} else if (result.type == POINTEDTHING_NODE) {
|
||||
// Update selection boxes
|
||||
MapNode n = map.getNode(result.node_undersurface);
|
||||
|
@ -3339,10 +3345,8 @@ PointedThing Game::updatePointedThing(
|
|||
}
|
||||
hud->setSelectionPos(intToFloat(result.node_undersurface, BS),
|
||||
camera_offset);
|
||||
hud->setSelectedFaceNormal(v3f(
|
||||
result.intersection_normal.X,
|
||||
result.intersection_normal.Y,
|
||||
result.intersection_normal.Z));
|
||||
hud->setSelectionRotation(v3f());
|
||||
hud->setSelectedFaceNormal(result.intersection_normal);
|
||||
}
|
||||
|
||||
// Update selection mesh light level and vertex colors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue