mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Use matrix4::getRotationRadians
This commit is contained in:
parent
b6c71b2379
commit
d74af2f1a7
10 changed files with 34 additions and 28 deletions
|
@ -441,8 +441,8 @@ void ClientEnvironment::getSelectedActiveObjects(
|
|||
GenericCAO* gcao = dynamic_cast<GenericCAO*>(obj);
|
||||
if (gcao != nullptr && gcao->getProperties().rotate_selectionbox) {
|
||||
gcao->getSceneNode()->updateAbsolutePosition();
|
||||
const v3f deg = obj->getSceneNode()->getAbsoluteTransformation().getRotationDegrees();
|
||||
collision = boxLineCollision(selection_box, deg,
|
||||
const v3f rad = obj->getSceneNode()->getAbsoluteTransformation().getRotationRadians();
|
||||
collision = boxLineCollision(selection_box, rad,
|
||||
rel_pos, line_vector, ¤t_intersection, ¤t_normal, ¤t_raw_normal);
|
||||
} else {
|
||||
collision = boxLineCollision(selection_box, rel_pos, line_vector,
|
||||
|
|
|
@ -3239,9 +3239,10 @@ PointedThing Game::updatePointedThing(
|
|||
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());
|
||||
hud->setSelectionRotationRadians(gcao->getSceneNode()
|
||||
->getAbsoluteTransformation().getRotationRadians());
|
||||
else
|
||||
hud->setSelectionRotation(v3f());
|
||||
hud->setSelectionRotationRadians(v3f());
|
||||
}
|
||||
hud->setSelectedFaceNormal(result.raw_intersection_normal);
|
||||
} else if (result.type == POINTEDTHING_NODE) {
|
||||
|
@ -3261,7 +3262,7 @@ PointedThing Game::updatePointedThing(
|
|||
}
|
||||
hud->setSelectionPos(intToFloat(result.node_undersurface, BS),
|
||||
camera_offset);
|
||||
hud->setSelectionRotation(v3f());
|
||||
hud->setSelectionRotationRadians(v3f());
|
||||
hud->setSelectedFaceNormal(result.intersection_normal);
|
||||
}
|
||||
|
||||
|
|
|
@ -880,7 +880,7 @@ void Hud::drawSelectionMesh()
|
|||
core::matrix4 translate;
|
||||
translate.setTranslation(m_selection_pos_with_offset);
|
||||
core::matrix4 rotation;
|
||||
rotation.setRotationDegrees(m_selection_rotation);
|
||||
rotation.setRotationRadians(m_selection_rotation_radians);
|
||||
driver->setTransform(video::ETS_WORLD, translate * rotation);
|
||||
|
||||
if (m_mode == HIGHLIGHT_BOX) {
|
||||
|
|
|
@ -74,9 +74,15 @@ public:
|
|||
|
||||
v3f getSelectionPos() const { return m_selection_pos; }
|
||||
|
||||
void setSelectionRotation(v3f rotation) { m_selection_rotation = rotation; }
|
||||
void setSelectionRotationRadians(v3f rotation)
|
||||
{
|
||||
m_selection_rotation_radians = rotation;
|
||||
}
|
||||
|
||||
v3f getSelectionRotation() const { return m_selection_rotation; }
|
||||
v3f getSelectionRotationRadians() const
|
||||
{
|
||||
return m_selection_rotation_radians;
|
||||
}
|
||||
|
||||
void setSelectionMeshColor(const video::SColor &color)
|
||||
{
|
||||
|
@ -129,7 +135,7 @@ private:
|
|||
std::vector<aabb3f> m_halo_boxes;
|
||||
v3f m_selection_pos;
|
||||
v3f m_selection_pos_with_offset;
|
||||
v3f m_selection_rotation;
|
||||
v3f m_selection_rotation_radians;
|
||||
|
||||
scene::IMesh *m_selection_mesh = nullptr;
|
||||
video::SColor m_selection_mesh_color;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue