Closed TheDuckCow closed 1 year ago
Update to this task: We are going to go down this route described below, as it will better serve many details later. Instead of the initial proposal above which keeps a Segments spatial, everything will be hierarchical to RoadPoints instead.
So the idea is that in a formed scene, you might have a structure like this:
Some rationales for this structure:
I'll update this task as I refine it further, but it is the first major work to take on to get this all working.
This task is in progress, and arguably done.. however the result has exasperated underlying issues that have to do how geo is transformed from local to global space.
Due to RoadSegments now being children of RoadPoints, which are themselves rotated by the user, we have cascading transforms to inverse and undo. I made an initial quick fix that seemed to undo rotation and was evidently working well, but upon further review I found that connecting road segments with non-xz flat orientations created weird twisting that was not present before. Additionally, when it comes to intersections and prefab scenes, we know it will be important to be able to rotate and translate entire road networks without consequences. Right now translation is fine, but rotation has long been a no-go (in fact, the very original version of the RoadNetwork class actually had it as a base Node object, not a spatial, to try and prevent any transformations).
So, instead of continuing to build on a stack of cards, I'm rolling up my sleeves and trying to get my head around the particular points of issues. What I've come up with is the following areas needing fixing
These changes are all going into the 74-restructure-points-and-segments
because I don't want to merge this branch if it creates new quirks that weren't present before. Stay tuned as I wrap my head around the right sequence of xform and xform_inv's...
The good news is this branch is just about ready finally! I was able to resolve the last of the consistency issues yesterday. However with some QA playing around with it today, there's one annoyance now with the new structure:
When you select a roadpoint, you see a bounding box around the road segment contained within it. While in one way this is actually nice as it clearly indicates which roadpoint owns that segment of road, it's rather distracting especially as you rotate or move the roadpoint around (since the box continually is resizing). It would be nice to have control over how we visualize the owned roadsegment by disabling this selection box outline.
Right now, we have RoadPoints as children of a points node which needs to be added as a spatial to the scene.
However, there are new oddities introduced if the player then tries to move/rotate/etc the "points". Furthermore, this points node would have to remain as a Spatial if RoadPoints are to be parented to it, otherwise we can't get the benefit of chained parent-child transform chaining.
The proposal, which is not backwards compatible:
points
node.segments
node hidden int he editor, and strictly always placed as a direct child (removing the option for users to move this around as they please). RoadSegments would still be parented to this node, and it still needs to be a spatial for show/hide to work correctly.