Skip to content

Conversation

@kianzarrin
Copy link
Collaborator

@kianzarrin kianzarrin commented Feb 2, 2020

fixes #625

See #625 (comment) for pictures

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:

  • TMPE does not draw lane curves for metros. I fixed that.
  • also draw lane curve when mouse is not hovering over anything.

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)

@originalfoo
Copy link
Member

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.

The mouse/camera delta & de-spam caching mechanism would be super-useful for lots of other things too, for example caching of visible nodes/segments for persistent overlays, etc.

@originalfoo originalfoo added enhancement Improve existing feature LANE ROUTING Feature: Lane arrows / connectors UI User interface updates Usability Make mod easier to use labels Feb 2, 2020
@originalfoo originalfoo added this to the 11.1 milestone Feb 2, 2020
Copy link
Collaborator Author

@kianzarrin kianzarrin left a 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.

@originalfoo
Copy link
Member

originalfoo commented Feb 8, 2020

Downside to showing all outgoing sheaths for current incoming lane is when I want to remove an existing connection.

Maybe if connected-but-not-hovered outgoing lane was given same colour sheath as the incoming lane. If I hover an outgoing lane, it's sheath would turn white, whether connected or not?

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

@originalfoo
Copy link
Member

originalfoo commented Feb 8, 2020

Minor buglet (can be left to future PR) - station track source sheaths are white:
image
EDIT: That's train station using RWY (Railway) rail tracks and station tracks.

It's bit of weird scenario because station tracks are both incoming and outgoing lanes.

@kianzarrin
Copy link
Collaborator Author

kianzarrin commented Feb 8, 2020

@aubergine10 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).

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

@kianzarrin
Copy link
Collaborator Author

Minor buglet (can be left to future PR) - station track source sheaths are white:
image
EDIT: That's train station using RWY (Railway) rail tracks and station tracks.

It's bit of weird scenario because station tracks are both incoming and outgoing lanes.

Well spotted! I changed half a line of code. should be fixed now:
Screenshot (417)
Screenshot (419)
Screenshot (418)

@kianzarrin
Copy link
Collaborator Author

@aubergine10

Here is a better illustration of why I'd like outgoing sheaths shown for currently selected incoming lane.
image
I have red incoming lane connected to 2 outgoing lanes, but only one is clearly visible. If both connected outgoing lanes had sheath, it would be very obvious which lanes red incoming lane connects to.
If I deselect the red incoming lane, the outgoing lanes it connects to would remove their sheaths. Hope that makes sense. :)

Oops almost didn't see this one. github confuses me. sometimes I don't see messages.
Fixed it! I draw the lane curves to the selected marker last so that they are on top. also they are emboldened with different (grey) border color.

Screenshot (421)

Screenshot (420)

We can discuss all those complex Lane sheath stuff in another PR if that is OK.

@kianzarrin kianzarrin changed the title boost lane hover Pimped-up lane hover ! Feb 8, 2020
floating lane curve 0.11mm white border
selected lane curves:  0.18mm grey border
other lane curves: 0.08mm black border
@originalfoo
Copy link
Member

originalfoo commented Feb 8, 2020

Create issue with all the future ideas: #670

@originalfoo
Copy link
Member

@krzychu124 any feedback on code, etc? this PR is read for merge pending your review

Copy link
Collaborator

@kvakvs kvakvs left a 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

Copy link
Member

@originalfoo originalfoo left a 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

@kvakvs
Copy link
Collaborator

kvakvs commented Feb 8, 2020

Nice

Copy link
Member

@originalfoo originalfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@originalfoo
Copy link
Member

@krzychu124 this is ready to merge - any comments?

Copy link
Member

@originalfoo originalfoo left a 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...

@originalfoo
Copy link
Member

originalfoo commented Feb 9, 2020

When I click on this blue lane:

image

The exiting line connecting to the outgoing lane goes mental:

image

Green lane is same:

image

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 :)

image

Looks like the station track fix broke all the other types of lane connector...

@kianzarrin
Copy link
Collaborator Author

kianzarrin commented Feb 9, 2020

@aubergine10 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.

Copy link
Member

@originalfoo originalfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Working great now!

image

@krzychu124
Copy link
Member

Testing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve existing feature LANE ROUTING Feature: Lane arrows / connectors UI User interface updates Usability Make mod easier to use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lane connector should raycast the whole lane Lane connector: Hovering over lane points is difficult when cars and roads are passing over.

4 participants