Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force Mesh creation at runtime?
#3
This code does not work, unless, I put it into a co-routine with a 0.1f second wait.

Code:
   // Create the spline
   var GENERATOR = CurvyGenerator.Create();
   var SHAPE = Rails[0].CopyTo(GENERATOR);

   var PATH = GENERATOR.AddModule<InputSplinePath>();
   var EXTRUSION = GENERATOR.AddModule<BuildShapeExtrusion>();
   var VOLUME = GENERATOR.AddModule<BuildVolumeMesh>();
   VOLUME.SetMaterial(0, RailMaterials[1]);
   VOLUME.MaterialSetttings[0].KeepAspect = CGKeepAspectMode.ScaleU;
   var MESH = GENERATOR.AddModule<CreateMesh>();

   // Wire the Generator Parts
   PATH.OutputByName["Path"].LinkTo(EXTRUSION.InputByName["Path"]);
   SHAPE.OutputByName["Shape"].LinkTo(EXTRUSION.InputByName["Cross"]);
   EXTRUSION.OutputByName["Volume"].LinkTo(VOLUME.InputByName["Volume"]);
   VOLUME.OutputByName["VMesh"].LinkTo(MESH.InputByName["VMesh"]);

   // Create the spline
   PATH.Spline = CurvySpline.Create();

   GENERATOR.Initialize(true);

   // ... logic to add points to SPLINE

   GENERATOR.Refresh(true);
   var CREATED_MESH = MESH.SaveToScene(myGameObject.transform);

   // CREATED_MESH is null
Reply


Messages In This Thread
Force Mesh creation at runtime? - by Elenesski - 09-18-2016, 03:29 AM
RE: Force Mesh creation at runtime? - by Jake - 09-19-2016, 03:15 PM
RE: Force Mesh creation at runtime? - by Elenesski - 09-19-2016, 07:56 PM
RE: Force Mesh creation at runtime? - by Jake - 09-21-2016, 06:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a way to generate UVs along deformed and copied mesh? kubak 1 323 03-18-2026, 08:34 PM
Last Post: _Aka_
  Replace deform mesh on volume spots Kokoriko49 1 2,335 06-09-2025, 06:49 PM
Last Post: _Aka_
  Mesh Generation between two splines vatan 4 3,648 02-14-2025, 07:11 AM
Last Post: vatan
  Create Mesh Node, Make Static Options rickgplus 1 1,835 01-23-2025, 10:12 AM
Last Post: _Aka_

Forum Jump: