Skip to content

Commit

Permalink
Fixed transform control example
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde committed Jan 29, 2021
1 parent 61cc21b commit 6ce2df9
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions examples/transform_control/GlutWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 +169,26 @@ void handleTransform()
{
// get the visual at mouse position
ignition::math::Vector2i mousePos(g_mouse.x, g_mouse.y);
ir::VisualPtr visual = rayCamera->VisualAt(mousePos);
if (visual)
ir::ScenePtr scene = rayCamera->Scene();
if (scene)
{
// check if the visual is an axis in the gizmo visual
ignition::math::Vector3d axis =
g_transformControl.AxisById(visual->Id());
if (axis != ignition::math::Vector3d::Zero)
ir::VisualPtr visual = scene->VisualAt(rayCamera, mousePos);
if (visual)
{
// start the transform process
g_transformControl.SetActiveAxis(axis);
g_transformControl.Start();

g_mouse.buttonDirty = false;
// check if the visual is an axis in the gizmo visual
ignition::math::Vector3d axis =
g_transformControl.AxisById(visual->Id());
if (axis != ignition::math::Vector3d::Zero)
{
// start the transform process
g_transformControl.SetActiveAxis(axis);
g_transformControl.Start();

g_mouse.buttonDirty = false;
}
else
return;
}
else
return;
}
}
// mouse release
Expand Down

0 comments on commit 6ce2df9

Please sign in to comment.