Jump to content

[SOLVED] Get exact value for Spline/Road intersection


photo

Recommended Posts

Hi,

I am currently trying to migrate my traffic network code to support the new spline system. While this is working for segments I am struggeling to implement the intersections.

spline_screen.png.3a9451e8b2399dd97c339159be3b8a8a.png

What I tried was to get the source mesh for the spline point (if any) and calculate the exact outer bone positions. Those positions should be the entry/exit point for the intersections. Therefor I can currently only calculate the position of the source mesh, without considering the rotation of the node. With the "getSources"-function I am only able to get a GUID for the used skinned mesh, which I can load separately but not directly from the WorldSplineGraph.

For my use case I want to get either the exact t-value of the nearby spline segments, where those positions are. I am also able to calculate from a "nearby" position the closest t-value by myself, but therefor I have to use a proper position vector.

So is it currently somehow possible to get/calculate those positions or can this be added with the next version?

 

Best

Christian

Link to comment

Hi Christian,

I think I'm missing something. So you have a modified crossroad, it has bent entries and exits. What do you mean by the exact value of the nearby spline segments? What should it be? Coordinates only? 

Can you explain a little bit more?

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi morbid,

of course! The above example is the sample road network, provided within the demo tab of your SDK browser. For the current implementation of your spline system dedicated for roads, each spline segment (bezier curve) starts and ends at a spline point. For simple road segments this is fine, because the applied mesh are tiled and stretched between an exact start and end point of a spline segment. But for intersections you have a problem. The segment mesh couldn't be stretched until the intersection point, because it will overlap with the node mesh at your intersection.

As far as I can interpret your implementation of the spline system, you place a skinned mesh at the SplinePoint where an intersection happened. I took a look into your fbx file and the intersection meshes ("cross-x", "cross-y",...) have multiple bones, where the intersection entry/exit of your mesh will be. During the generation process, the bones will be placed along the spline to fit the curve. The stretched mesh from your segment will not be stretched 'til the SplinePoint, but to the position, where the bone is. drawing.thumb.png.72afd7db805302c950082d3b8f29537f.png

In the above picture you can see the intersection skinned mesh, with the bones. Thos will be aligned to the bottom, blue line (the spline). What I need is the exact (world) position, where those bones will be placed/ the intersection mesh from the SplinePoints ends and the tiled mesh from the SplineSegment starts (green circle). Therefor, one of the following two approaches is enough:

1. Getting the exact (world) position of the bones. Because they are aligned with the spline segment you can easily convert them to the specified t-value of the segment. At the current API, you can get the source name of the mesh, that will be used as intersection mesh. Unfortunately this is only the guid, where I am able to load the specified mesh by myself, without any transformation of the intersection, and the re-positioning of the child bones.

2. Getting the t-Value of the SplineSegment, where the intersection mesh ends/ the stretched tile mesh starts. With the current function you can easily convert them to a (world) position.

 

Last but not least a screenshot of my currently generated traffic lanes:

example_traffic.thumb.png.47736739e1d2616f0cb5fb760fd8c41a.png

The white lines represent the spline of the SplineSegment itself. Blue/Green lines are just the left/right lanes of a road. Here, the spline should end at the intersection entry/exit. For now, the splines should be drawn from position t= 0 until t= t1, where t1 is the intersection entry/exit. In my second step I will create new splines inside the intersection to allow my agents traveling in different directions. In the above picture I got the SourceName of the intersection mesh, loaded them seperately and calculated the t1-values by myself. Problem: The loaded source mesh is neither rotated, nor their bones re-aligned with the SplineSegments.

I guess in your implementation you already know where those bones of the intersection mesh will be positioned, because you re-align them with the SplineSegment. The tiled/stretched nodes of the SplineSegment ends perfectly at the position, where the intersection mesh started.

 

Regards

Christian

Link to comment
  • 2 months later...

Hi morbid,

 

I dived into the changelog of the 2.8 release but couldn't find any hint about the implementation of bone positions. The documentation wasn't updated as well. Does it mean, that this feature will be available in the next release?

 

Link to comment
  • 2 months later...

Hi morbid, that is awesome and definetly what we are looking for. Looking forward to test the new feature and working on our traffic system again.

 

Best

Christian

Link to comment
  • morbid changed the title to [SOLVED] Get exact value for Spline/Road intersection
×
×
  • Create New...