-
Notifications
You must be signed in to change notification settings - Fork 88
Pimped-up lane hover ! #635
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
Pimped-up lane hover ! #635
Conversation
removed unnecessary setter for SubTool.Hovered*Id tested and works
added segment lane markers. polished code optimised performance
cleaned up code.
|
Regarding caching: If I'm moving the mouse over the screen, it doesn't really need to recalculate on every frame. Maybe add a de-spam of 250ms between refreshes? (inperceptible to most humans) Also, what happens if user changes camera view via keyboard (eg. cursor keys; no mouse movement)? That should invaldiate cache.
|
kianzarrin
left a comment
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.
@aubergine10
Also, what happens if user changes camera view via keyboard (eg. cursor keys; no mouse movement)? That should invaldiate cache.
Mouse ray will change ... I think. To be honest I don't know what exactly is mouse ray. I am checking for mouse position on terrain and THAT will change if you move the screen.
Or.... When hovering non-connected outgoing lane, it gets white sheath. When connected to currentluy-selected incoming lane, the outgoing sheath remains white (while assocaited incoming lane still selected). But if I then hover an already-connected outgoing lane (for currently selected incoming lane), the outgoing sheath takes on colour of the incoming lane indicating that if I click that outgoing lane the wire is going to get reeled back in to the incoming lane (ie. disconnected from that outgoing lane). Same could be done with the "wire": Dragged wire (following mouse) = white = "stick me in a white hole / sheath". Connected wire = white = distinguishes the currently active wires (for selected incoming lane) from any others on the junction/node (as they are all coloured). But if I then hover over already-connected (to currently selected incoming lane) outgoing lane, the wire turns same colour as incoming lane = "that's where it's going if you click now - back to the coloured lane" = connection will break. Hope that makes even a remote amount of sense lol |
incoming is ambiguous. is it incoming lane from the junction or toward the junction? depends on where the observer is. is it source? is it target? I don't mind doing it but I would like there to be discussion rather than last minute rush. lets do it in another review. I will fix the white train station sheath issue |
floating lane curve 0.11mm white border selected lane curves: 0.18mm grey border other lane curves: 0.08mm black border
|
Create issue with all the future ideas: #670 |
|
@krzychu124 any feedback on code, etc? this PR is read for merge pending your review |
kvakvs
left a comment
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.
Style/comment notes remaining
originalfoo
left a comment
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.
See kvakvs' comments above
|
Nice |
originalfoo
left a comment
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 👍
|
@krzychu124 this is ready to merge - any comments? |
originalfoo
left a comment
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.
Something's gone fubar with latest commit - see images below...
|
When I click on this blue lane: The exiting line connecting to the outgoing lane goes mental: Green lane is same: Looks like it's adding about 5 lane connector wires for each connected outgoing lane. Seems to be happening on all my roads. Station tracks are fixed though :) Looks like the station track fix broke all the other types of lane connector... |
It can't be! I tested it and it worked ... look: #635 (comment) Ill test it out again. OK fixed it. see diff. its one line fix with level of for loop. |
originalfoo
left a comment
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.
|
Testing... |












fixes #625
See #625 (comment) for pictures
As agreed in Lane connector: Hovering over lane points is difficult when cars and roads are passing over. #543 (comment) I make the whole lane hover-able.
Visual feedback:
If mouse pointer is on circle of the node lane marker then I don't highlight the whole lane. If the mouse pointer is on the lane but not on the circle, then I highlight the whole lane. This conditional display lane overlay is an answer to lane connector should raycast the whole lane #625 (comment)selected and hovered lanes (source or target) get Sheath overlay. I didn't change the color ... just the shape.
I revived the lane hovering code from Traffic ++
I made performance optimization by caching mouse pointer and lane bounds. They are recalculated only if user moves the mouse ray.
fixes #543
I fixed the vertical mismatch by intersecting the mouse ray at the place where it hits the road.
hitPos error: raycasting returns hitpos with error. it is as if the mouse ray penetrates the road segment a little bit. This error is partially mitigated by calling GetClosestLanePosition(). the returned vertical position still has less error and it does not cause any practical problem.
the fixed position takes 100us to calculate. So I cached it and it only recalculated if user moves the mouse ray.
EDIT: In the old code it is possible to turn the camera so extreme that two markers are hovered. I added a check to avoid that.
EDIT: fixed lane curves:
EDIT: for monorail I no longer hover rail projections on the ground, but rather I hover the road lane it self.
EDIT: train markers are both source and target and used to be rendered with white color even if they were the source of the selection. I fixed that to use original color. see #635 (comment)
EDIT: sometimes lane curves get berried under other lane curves. To mitigate this problem I render curves from selected lane on top of all others.
#635 (comment)