Fix selecting semi-transparent visuals #800
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Ian Chen [email protected]
🦟 Bug fix
Another fix for gazebosim/gz-sim#147, specifically the issue shown in the video in gazebosim/gz-sim#147 (comment)
Summary
The problem is that when clicking on semi-transparent visuals with nothing in the background, the ogre2 selection buffer returns
nan
point values. This causes entity selection to think that nothing is pressed by the mouse. Similarly when using the transform control tool, the user will not be able to click on the semi-transparent arrow visual if there is nothing in the background. For the entity selection and transform control functionality, we don't really need the point / distance results from the selection buffer ray query, so the workaround is to just make sure the visual object's ids is valid.The issue with
nan
values returned the selection buffer for semi-transparent object still persist, and I added a todo note for this.To test:
See video in gazebosim/gz-sim#147 (comment).
Alternatively:
launch gz-sim with shapes.sdf world
Right click the box and select
View
->Transparent
Click on another model in the scene to unselect the box
Try positioning the camera so that there is nothing behind the semi-transparent box (i.e. no ground plane in the background) similar to the idea shown in the video.
Use mouse to select the part of the box without background. Without this change, the box can not be selected.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.