Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shape Extrusion at Runtime via script
#1
Question 
Hey there Fluffy Underware team,

I'm trying to control the generator via script and have run into a problem I have not been able to figure out on my own.

Here's what I'm doing:

I have a Curvy Spline object that I add/remove points to/from at run time to create a small path - max 5 points long.  I'm handling the generation of the points via script... I determine an end position vector, do some math and fill in points leading to the end position vector... this is working exactly as I want it to.  I have a small spline that looks great.

Once the path is generated I want to extrude a shape on it and that's where I seem to be stuck.

I have my generator setup to use the template "Shape Extrusion". It's almost as-is from the template sans the scale which I made smaller for my purposes.

I assigned the Curvy Spline object (which holds the points at runtime) to the Input Spline Path module in the generator.

Here's where I get stuck:

At runtime I see the spline but the generator never generates a mesh for it as it does when I pre-set everything in the editor. 

I found that if I call Refresh() on the Input Spline Path object after I add the points at runtime I get a mesh generation - a mesh that seems to be the correct length is generated... but it does not follow the spline.

I've tried a number of things... refreshing the generator via code, looping through all the modules and refreshing them... adding/removing the spline at runtime based on my needs - pretty much everything leads down to the same place... when I extrude at runtime I wind up with a mesh that doesn't follow the spline.

Is it possible to extrude a shape along a given spline at runtime? If so... am I just doing something incorrectly?
Reply
#2
We have an example scene featuring exactly that (even creating the CG setup by code). About the curvation, I guess your spline is too short for the default extrusion settings. Try lowering CurvyGenerator.MinDistance and play with the spline's extrusion settings. Tip: Enable CG's debug view and check the number of generated spline vertices, perhaps add one of the debugging modules to get additional details and visuals.
Reply
#3
(04-13-2016, 07:09 PM)Jake Wrote: We have an example scene featuring exactly that (even creating the CG setup by code). About the curvation, I guess your spline is too short for the default extrusion settings. Try lowering CurvyGenerator.MinDistance and play with the spline's extrusion settings. Tip: Enable CG's debug view and check the number of generated spline vertices, perhaps add one of the debugging modules to get additional details and visuals.

Hi Jake

Does the examples scene still exist in the latest package? If so which one is it? I've gone through them all and not seen one that creates a generator at runtime. Thanks.
Reply
#4
He was talking about 51_InfiniteTrack.unity
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
  Adjust radius of generated mesh via script? Shackman 1 3 03-26-2024, 01:12 PM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
Wink Modifying Splines at Runtime artsung 1 7 01-30-2024, 09:40 AM
Last Post: _Aka_
  Is it possible to create a road texture at runtime? artsung 1 4 01-30-2024, 09:30 AM
Last Post: _Aka_

Forum Jump: