Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SplinePathMeshBuilder to Curvy Generator
#1
I am currently updating and improving code that was originally built bij another company using an older version of Curvy.
I basically fixed everything except for the code below:

Since I can't find really good examples online how to convert a SplinePathMeshBuilder to a Curvy Generator version I'd love to get some advice on how to convert this. Especially since I am new to Curvy.

Here's the code (and thanks in advance):  

     public SplinePathMeshBuilder CreateMesh ()
        {              
                var MeshBuilder = SplinePathMeshBuilder.Create ();
                
                spline.Refresh ();

                MeshBuilder.Spline = spline;
                MeshBuilder.CapShape = SplinePathMeshBuilder.MeshCapShape.Custom;
                MeshBuilder.StartMesh = railCapMesh;
                MeshBuilder.gameObject.layer = parentTransform.gameObject.layer;
                MeshBuilder.GetComponent<Renderer> ().material = railMaterial;
                MeshBuilder.UV = SplinePathMeshBuilder.MeshUV.Absolute;
                MeshBuilder.UVParameter = 0.12f; //width of the mapping in cm. 
                MeshBuilder.ExtrusionParameter = 3;
                MeshBuilder.EndCap = MeshBuilder.StartCap    = false;
                MeshBuilder.Refresh ();

                var coll = MeshBuilder.gameObject.AddComponent<MeshCollider> ();

                coll.isTrigger = true;

                railPieceSelection rps = MeshBuilder.gameObject.AddComponent<railPieceSelection> ();

                rps.railPiece = this;

                rps.selected += RailPieceSelectedEventHandler;
                
                MeshBuilder.transform.parent = parentTransform;
                
                return MeshBuilder;
            }

Reply
#2
That looks like an usual extrusion to me. Please look into the CG setup of one of the example scenes (e.g. 21_CGExtrusion). Tipp: you can add whole templates like the above extrusion to a CG graph (see the tutorial vid about it).

If you want to create a whole CG by code, see 51_InfiniteTrack - that example creates both a spline path and a CG by code. That's a bit extreme though: the best approach is to create a decent CG that does what you want, then change options by script if neccessary.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 12 04-03-2024, 03:16 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 5 03-27-2024, 07:25 AM
Last Post: amutp

Forum Jump: