diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2022-10-30 16:53:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-30 16:53:14 +0100 |
commit | 077627181ee2eac3c0dacc3d8dc49825837e474c (patch) | |
tree | a8a6298198738f2edb30bd7e733a7a0d2005affa /src/client/game.cpp | |
parent | b8292319924994352d56d6111faa73fe315d149a (diff) | |
download | minetest-077627181ee2eac3c0dacc3d8dc49825837e474c.tar.xz |
Allow rotating entity selectionboxes (#12379)
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r-- | src/client/game.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp index 91c93ef7f..cdcfde759 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -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 |