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
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  how do I position a splineController on a spline in runtime to an exact position? hawken 8 616 01-19-2018, 12:01 PM
Last Post: _Aka_
  Easy way to make a spiral shape from spline Krypton 1 293 01-17-2018, 10:50 PM
Last Post: _Aka_
  Spline Path Extrusion Elenesski 3 361 01-17-2018, 02:45 AM
Last Post: Elenesski
Bug Shape extrusion "range" changes in run time to "length" hawken 2 232 01-15-2018, 03:15 AM
Last Post: hawken

Forum Jump: