Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unpredictable mesh generation
#1
Hi!

I'm creating a vertical road using the generator (shape extrusion) and feeding it a a randomly generated set of control points.
The road itself is completely flat (localPosition.z is always = 0).

About 50% of the time the generated mesh is perfect (it took me a while to avoid overlapping triangles and getting z fighting) and the remaining times the road insists on behaving unexpectedly.
It all depends on what I select as Orientation under my Curvy Spline general settings: 
- if I select "Static": some parts of the mesh will be flipped 180°  (this happens 100% of the time) (picture 1).
- If I select "Dynamic": sometimes (~50%) I get what I want (picture 2) and sometimes it starts twisting around (picture 3) and when it does it's not like the road is always perpendicular to the x axis... it may start correctly aligned and then corkscrew around the Y axis...

   

this is the main loop that generates the spline:

Code:
        CurvySpline CS = RoadSpline.GetComponent<CurvySpline>();
        for (int i = 0; i < numberOfCPs; i++)
        {
            CurvySplineSegment CSS_Last = CS.ControlPoints[CS.ControlPoints.Count - 1];
            CurvySplineSegment CSS = CS.InsertAfter(CSS_Last);
            float xPosition = Random.Range(-maxHorizontalWidth, maxHorizontalWidth);
            float yPosition = CSS_Last.localPosition.y + verticalSpacingBetweenCPs;
            CSS.localPosition = new Vector3(xPosition, yPosition , 0);
            CSS.localRotation = CSS_Last.localRotation; //this doesn't help either
            

        }


any ideas?

Thank you for your help!
Reply


Messages In This Thread
unpredictable mesh generation - by BlackRainbowFT - 05-04-2016, 12:24 PM
RE: unpredictable mesh generation - by Jake - 05-05-2016, 10:08 AM
RE: unpredictable mesh generation - by Jake - 05-06-2016, 08:51 AM
RE: unpredictable mesh generation - by Jake - 05-18-2016, 07:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
  Adjust radius of generated mesh via script? Shackman 1 4 03-26-2024, 01:12 PM
Last Post: _Aka_
  Not seeing mesh extended after following YT PaulM 1 3 02-02-2024, 12:01 PM
Last Post: _Aka_
  Trigger Zones along Spline Mesh dlees9191 1 5 01-05-2024, 10:18 AM
Last Post: _Aka_

Forum Jump: