Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change Shape Extrusion of Generator by code
#1
Hello,

[Image: IFdjWaGoi5k_shape.PNG]

I Would Like from an editor script, to access this 2 property and modify it, and then Update the CurvyGenerator.

My goal is: I have 2 custom SPlineController on the road, and depending of their percent on the road, create a mesh from the start of it to the end, like that:
[Image: IFdke2HQW6k_curvy.PNG]
(For now, I have set this value from your CurvyGenerator editor)

So now from code: I have in my script the CurvyGenerator reference.

1) First, I would like to Set the Spline of the curvyGenegator dynamically.
I Guess I have to search for
Code:
curvyGenerator.InputSplinePath.Spline = mySpline
.
But I don't find how to get it.

2) Next, I would like to do something like:
Code:
curvyGenerator.BuildShapeExtrusion.Range = 0.02f;

curvyGenerator.BuildShapeExtrusion.Lenght = 0.001f;

3) And then:
Code:
curvyGenerator.Refresh()
-> will it refresh the mesh ?
Reply
#2
1) curvyGenerator.Modules.OfType<InputSplinePath>() will give you the modules of said type.Then select the module you want, and assign its spline through the Spline property
2) same method as before to get the BuildShapeExtrusion module, than use the From, To, and Length properties, depending on your preferences
3) Calling Refresh will refresh the mesh. Be aware of the existence of its optional parameter
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Mesh index warning at extrusion Tim1234 4 74 06-14-2019, 11:09 AM
Last Post: Tim1234
  One generator for multiple paths justinms66 10 1,693 05-30-2019, 03:48 AM
Last Post: Horibe
Information [Quick and dirty] Shape Extrusion: interpolate between multiple Crosses _Aka_ 7 1,721 04-28-2019, 11:02 PM
Last Post: ChivalrousGames
  Connections during speed change 3583Bytes 8 681 04-05-2019, 01:12 PM
Last Post: _Aka_

Forum Jump: