-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add arrow to selected lanes #223
Conversation
895035b
to
eaaca3e
Compare
moveDown = true; | ||
currentTick = 0; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi haha you did it. Consider turning moveDown
into a an integer that can be either -1
or 1
and multiples step
before summation. It'll simplify the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi nit: can we call moveDown
something else e.g. currentDirection
?
|
||
public: | ||
|
||
/// \brief Constructor. Creates a cone and adds it as a child to the RootVisual of the scene, which will move |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi consider removing Constructor.
, it is somewhat redundant.
/// \brief Moves the arrow to a given world position and resets the downwards movement. | ||
/// \param[in] _distanceFromCamera How far the camera is from the clicked point. | ||
/// \param[in] _worldPosition World position of the cursor ray cast click. | ||
void MoveArrowAt(double _distanceFromCamera, const ignition::math::Vector3d& _worldPosition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi I'm not sure MoveArrowAt
expresses the intent you describe in the documentation. Consider HoverOver
or something along those lines.
void MoveArrowAt(double _distanceFromCamera, const ignition::math::Vector3d& _worldPosition); | ||
/// \brief Toggles the visibility of the arrow. | ||
/// \param[in] _visible Boolean that determines if the arrow should be visible or not. | ||
void SetArrowVisibility(bool _visible); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi consider SetVisibility
, Arrow
is likely redundant.
|
||
const double scaleIncrement = 1.0 + scaleFactor * _distanceFromCamera; | ||
const double newMinBBZAxis = scaleIncrement * minBoundingBox.Z(); | ||
this->arrow->SetWorldScale(scaleIncrement, scaleIncrement, scaleIncrement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi I see what you're doing here, but does it scale appropriately if you zoom in/out? Should the scaling code be separate and called upon zoom?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice it looks fine to me. I wanted to avoid user interaction with the arrow's scale directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'll take a look locally.
eaaca3e
to
4e6372c
Compare
moveDown = true; | ||
currentTick = 0; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi nit: can we call moveDown
something else e.g. currentDirection
?
/// \brief Move the arrow based on the distance travelled by the camera's ray distance. | ||
/// \param[in] _distance Distance travelled from the camera's world position to the clicked object. | ||
/// \param[in] _worldPosition Position where the camera's ray hit. | ||
void MoveArrowAt(double _distance, const ignition::math::Vector3d& _worldPosition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi PutArrowAt
?
/// \param[in] _distanceFromCamera How far the camera is from the clicked point. | ||
/// \param[in] _worldPosition World position of the cursor ray cast click. | ||
void SelectAt(double _distanceFromCamera, const ignition::math::Vector3d& _worldPosition); | ||
/// \brief Toggles the visibility of the arrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi nit: add one extra blank line here.
|
||
const double scaleIncrement = 1.0 + scaleFactor * _distanceFromCamera; | ||
const double newMinBBZAxis = scaleIncrement * minBoundingBox.Z(); | ||
this->arrow->SetWorldScale(scaleIncrement, scaleIncrement, scaleIncrement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'll take a look locally.
4e6372c
to
ab8d180
Compare
Feedback from @liangfok and @andrewbest-tri: lower the arrow so that it lays closer to the lane surface and casted shadows become a better indicator. |
Can you post a screenshot? |
Looks good. Thanks for the screenshot. Perhaps changing the color of the yellow edge of the lane that's selected, it'll be even more clear. When there's multiple overlapping lanes with no height difference, like at an intersection, I wander if we can click multiple times, each time changing which of the N overlapping lanes is selected. |
For the moment, we can't do anything to a single lane, since the road is only one mesh, so changing the material will imply that the whole road will change. #218 explains the problems we have. This is meant to be a quick and cheap solution (better than nothing) until we can find out how to make a proper outline since it's not easy to do |
311ba5f
to
bc5542d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending conflict resolution
2c268b0
to
1bd709c
Compare
ignition::math::Vector3d worldPosition = this->arrow->WorldPosition(); | ||
this->arrow->SetWorldPosition(worldPosition.X(), worldPosition.Y(), worldPosition.Z() + currentDirection * step); | ||
++currentTick; | ||
if (currentTick == totalTicks) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi nit: last two lines could be collapsed into one.
this->cylinder->SetVisible(false); | ||
this->cylinder->SetWorldPosition(0., 0., 0.); | ||
// This size is enough for visualization. | ||
this->cylinder->SetWorldScale(0.5, 0.5, 0.2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BMarchi as I told you offline, this is likely to run into some issues when dealing with very small lanes. Unless we somehow bound its size by the lane's area, which is going to be tough. Maybe once we get an outline we don't need this one anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arrow is useful but I think that with the outliner, the cylinder isn't necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending green CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as soon as CI catches up.
Ready for review